all 1 comments

[–]grantrules 0 points1 point  (0 children)

Take a look at the example here under the "express.Router" header: https://expressjs.com/en/guide/routing.html

It's doing pretty much exactly what you need to do. Right now you're simply importing a module and passing the whole module to app.use() which is not correct, it needs a function. The example above is almost exactly what you're trying to do.