In Express.js, to limit the middleware execution to a particular HTTP method, you should use the ______ method.

  • app.use()
  • router.use()
  • app.method()
  • router.method()
To limit the execution of middleware to a specific HTTP method in Express.js, you should use the router.use() method and specify the HTTP method as an argument, such as router.use('GET', middlewareFunction). This ensures that the middleware is only executed for requests with the specified method.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *