Background:
- Nodejs app using expressjs.
- Hosted on IIS using IISNode
- Nodejs app is in virtual directory called /myVirtualDirectory
Problem:
You want to provide static files or css using less but the url that is passed to nodejs is the full url and doesn’t match what would be expected with a standalone nodejs app.
Solution:
Note where we have specified the middleware to use we have passed in the url prefix for it to respond to. As long as this is the same as the name of the virtual directory this will match and your files will be served up as expected.