I am running into some issues with running a Node app on Azure WebSites due to IISNode. Basically the issue is that I am relying on the port number being a number, which frankly is not the case on Azure ... Here the port number is actually a named pipe, and has values like \\.\pipe\76deda07-ef5c-4539-87d8-755ede772521
. Thus, the following piece of code, which routes an internal request back onto the HTTP routes defined on localhost, does not work:
function getFromLocalRoute(restPayloadObject, callback) {
request.get({
uri : util.format('http://localhost:%s/api/%s', app.config.port, restPayloadObject.servicepath),
json : true
}, callback);
}
It should go without saying that this works fine on *nix systems, but now I need to find a nice way of handling this that works on Windows as well.
What I am after is basically this:
- I have a url that exists on localhost
- I would like to call the url on localhost using this url
- It must work using IISNode
It does not have to use HTTP. I simply want to reuse the logic that is implicit by using Express to handle my routing logic, parsing everything, sending it on to the right modules, etc. So if there is a way of calling the Express Router without using HTTP that would be perfect.
Related:
- Node HTTP request using a named pipe
- Is it possible to call Express Router directly from code with a "fake" request?