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.
Loading...
Related Quiz
- In JavaScript, the ______ property is used to set up inheritance between custom types.
- What is the role of the error-handling middleware when dealing with unhandled promise rejections in Express?
- In a RESTful API, which HTTP method corresponds to the Update operation in CRUD?
- In a system following eventual consistency, what implications does it have on Read operations after a Write operation?
- How can you ensure the security of file uploads in a web application?