I have a Node.js app built using Coffescript on Express/Connect/Jade/Less.
The app will be deployed in a couple of different places and on different context paths, e.g
http://someurl.com/
http://someotherurl.com/andthenthispath/
I'm experiencing problems achieving this. My intention was to use a variable for the context path and populate that with an evironment variable in the second deployment location.
contextPath = process.env.CONTEXT_PATH || ''
I can then set up my routes like so,
app.get contextPath + '/', anIndexFunction
app.get contextPath + '/bla', aBlaFunction
This is starting to look overly messy, and then I also need to pull in this variable in any other location which will build a url.
I've been looking for a piece of Connect middleware that will handle this scenario in a nicer way, does that exist? Or is there a standard way to handle this?