Node.js with express routing and sub routing Node.js with express routing and sub routing express express

Node.js with express routing and sub routing


Router.use() expects an instance of another Router. However your (non-working) module only returns a function.

Use this in your index.js to fix the issue:

router.use('/users', require('./users')());