I watched the tutorial here:
.. and got inspired to break up my ever-growing application into distinct modules. The high level structure is as follows (some parts deleted for brevity):
server.js:
var express = require('express')
, orgs = require('./lib/orgs');
var app = express();
app.configure(function () {
app.disable('x-powered-by');
app.use(orgs);
});
http.createServer(app).listen(app.get('port'), function () {
console.log("Express server listening on port " + app.get('port'));
});
lib/orgs/index.js
var express = require("express")
, app = module.exports = express()
It works great. However, I have a small problem which may lead to bigger problems going forward. When I structure my app this way (e.g. having express 'submodules'), the x-powered-by is not disabled, which leads me to believe that all app config stuff is not read as well. I have tried to place the disable message before and after calling the orgs submodule.
Can someone please help me understand this? Thanks
This was identified as a bug and has since been fixed here:
https://github.com/visionmedia/express/commit/fa8eec449bf406cebd7a92d376a098a39a804879