I’m having problems deploying a middleware in the routes of my application, basically, its structure is as shown in the following screenshots.
The error returned when starting the application is: Error: Route.get() requires a callback function but got a [object Object]
My application doesn’t have the (req, res) right there after the route declaration, if so, I would just add the middleware first, however, see that my application calls the list method inside the Class Unit directly in the route declaration. How do I increment Middleware there?
You missed exporting middleware function.
Answered By – Abbas Moharami