I need to return the path of the Host or the entire url
Have a look at
https://nodejs.org/api/http.html
and
https://nodejs.org/docs/v0.4.12/api/http.html#http.ServerRequest
and/or Google the subject
There is no HTTP_HOST property in node, in ASP/PHP it came from the web server (apache/IIS). nodejs uses a build-in web server that doesn’t have these variables. I will have a look to include several of the server variables in nodejs to simulate the ones in ASP/PHP.
In the next update the $_SERVER
will match a lot of the ASP/PHP variables. The current variables in $_SERVER
will be moved to $_ENV
since they are environment variables and not server variables.
There is an alternative for $_SERVER.HTTP_HOST
, you can use $_HEADER.host
instead.
Does this mean we have the ability to set environment variables per target, or is this something coming later?
Environment variables are read only, to set them you have to do that on the server and not from code.
Exactly. I’m not suggesting we could set them in code, only that we could set them up on the Project Settings > Targets.