Reputation: 1781
I'm currently running iisnode on IIS7. Currently there's just one app (app.js) on there which makes use of MongoDB. Just to clarify, when I say 'app' I'm referring to an actual ExpressJS application.
What I would like to be able to do is host multiple express apps from the same place. So for example if you went to /app2/ it would load up app.js within that folder. I think that's do-able with re-write rules but I'm not so sure that's the best way. Maybe it would be better just to have some kind of controller that switches to an app depending on the sub-domain or path?
Here's the structure I was gunning for:
Site Root
|_ app1/
| |___ app.js
| |___ routes/
| |___ models/
| |___ public/
|
|_ app2/
|___ app.js
|___ routes/
|___ models/
|___ public/
Just putting this question out there to get some suggestions on the best approaches for this kind of set up. iisnode typically is configured with just one app.js:
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
Maybe there can be more than one or maybe app.js act like a proxy?
Any help appreciated!
Upvotes: 2
Views: 1821
Reputation: 8542
I would create a wrapper express application and used it to forward routes to your two apps. That's the approach TJ Holowaychuk - the author of Express - recommends. See his short screencast for details.
Upvotes: 4