Right, should’ve shown the code beforehand. Here goes:
Please note that I have to use vhost for this case. For now, that seems to somehow work. But. If I pass a new connect instance to the api_handler.js file, it will never be reached. So I think my routing is a little f****d up…
When I tried to turn this whole thing into a clustered aproach (in hopes to increase speed, which seemed to not have been the case…) I had tried to make the orutes without the vhost module at all, which then looked like:
var connect = require("connect"),
app = connect(),
main = connect(),
api = connect(),
cdn = connect();
app.use(connectLogger());
app.use(responsetime());
app.use(compress());
// Now comes
app.use("/", main);
app.use("/cdn", cdn);
app.use("/api", api);
// The files were re-written by then.
require("lib/request_handler")(main);
require("lib/cdn_handler")(cdn);
require("lib/api_handler")(api);
But that resulted in a total mess. My main site loaded, but only the / route got hit - none of the others were! Even when I moved it to the bottom, same result…