TypeError: app.use() requires middleware functions

I had this problem when I left out

module.exports = router;

in my Routes.js.We need to export all the routes.

In my server.js, I had

var mainRoutes = require('./Routes.js')
app.use(mainRoutes)

So check your ‘app/routes/api’ file to see if it has proper export.

Leave a Comment