I would like to be able to connect the whole express application to the uri containing the parameter. I have something similar to the following:
in app.js:
var app_authors = require('./api/authors');
var app = express();
...
app.use('/api/authors', app_authors);
...
module.exports = app;
in api / authors.js:
var app_author_books = require('./api/books');
var app = express();
...
app.get('/:author', ...);
...
app.use('/:author/books', app_author_books);
...
module.exports = app;
While the first helper application is running, installed on top /api/authors, the sub does not (URLs of the form /api/authors/:author/books, etc. are not recognized)
EDIT:
For curious sub-applications, AFAIKs are not very well documented, but they should work, at least according to TJ Holowaychuk Modular web applications with Node.js and Express (and the associated vimeo screencast ). See Also this other SO answer.