I would like to define other middleware depending on how the path looks.

The fact is that the path can be careful; I would like, for example, to support the following paths:
/chat/auth/test
/chat/auth/add
/chrome/auth/test
/chrome/add
Every time auth is on the way, I would like the middleware name to be called, and for chat and chrome I want their respective intermediaries to be called.
app.js:
var chatAuthenticate = require('./server/middleware/chat-authenticate');
app.use('/chat', chatAuthenticate(addon));
var authAuthentication = require('./server/middleware/auth-authenticate');
app.use('/auth', authAuthentication());
, app.js , /chat/auth /chrome/auth, , , :)