TypeError: Router.use() requires a middleware function but got a Object – How to fix this Express/Node.js error?
TypeError: Router.use() requires a middleware function but got a Object – How to fix this Express/Node.js error? You would typically face this error when you define a new router and start your node.js app. But did you export your router? Nope.
Add this line at the end of your router definitions.
module.exports = router;