I'm having problems deploying a middleware in the routes of my application, basically, its structure is as shown in the following screenshots.
My middleware:
My Controller:
My routes.js
However, when I try to add the middleware to my route there is an error in the application, I am adding the middleware as follows:
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?
Thanks
CodePudding user response:
You missed exporting middleware function.