0

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:

enter image description here

My Controller:

enter image description here

My routes.js

enter image description here

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: enter image description here

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

1 Answer 1

1

You missed exporting middleware function.

Sign up to request clarification or add additional context in comments.

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
Great!! Works, thanks..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.