I have several apps that I\'m trying to merge into a single \"suite\": 2 apps are standalone, one is simply an auth layer (using everyauth for FB Connect). I want to set it
app.use(uri, instanceOfExpressServer)
Just make sure you don't call .listen
on it.
The alternative is to use require("cluster")
and invoke all your apps in a single master so that they share the same port. Then just get the routing to "just work"
Not sure if this helps you but I was looking to prefix my API routes. What I did was that when I initialized the router, I added the mount path. So my configuration looks like this
//Default configuration
app.configure(function(){
app.use(express.compress());
app.use(express.logger('dev'));
app.set('json spaces',0);
app.use(express.limit('2mb'));
app.use(express.bodyParser());
app.use('/api', app.router);
app.use(function(err, req, res, callback){
res.json(err.code, {});
});
});
Notice the '/api' when calling the router