At nuxtjs poroject, I have a configure variable of api environment like this:
[
{
front_host: local-1.domain.com,
backend_api: api-1.domain.com
},
{
front_host: local-2.domain.com,
backend_api: api-2.domain.com
},
]
I need get the right object element from the host name, for example, if the host name of my web page is "local-1.domain.name", then I shall get the object {front_host: local-1.domain.com, backend_api: api-2.domain.com}
.
In nuxtjs, if the web page renders at the front end, then I can get host name by location.host
, if at ssr(server side rendering), how can I get the host name?