I am using iisnode to host a node web application in IIS on Windows. When I set up my routes on the web server (say Express or Restify) I want do do it in a way that is independent of the path that IIS is hosting the application at.
For example, my application could be hosted at two different paths on two machines running IIS; the first could host it at /foo
and the second at /bar
. Say my application wants to set up a route at /baz
- on the first machine I would need to configure the route at /foo/baz
and on the second I would have to use /bar/baz
which means duplicating some of the configuration held in IIS.
Is it possible to reliably work out the path from within an application hosted with iisnode so that I can calculate the correct routes to set up? Or is there another technique I can use to avoid needing to do so?