32 questions for “Express & Middleware”

Found in 1 field. Select a question to see its full answer.

Information Technology

32 questions in 2 technologies

#QuestionTechnologyTopicLevel
1What is the difference between application-level, router-level, and route-specific middleware in Express? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
2What does the express.json() and express.urlencoded() built-in middleware do, and why must it be registered before routes that need to read req.body? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
3What is the purpose of the express.static() built-in middleware, and how would you use it to serve a folder of static assets? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareBeginner
4What is middleware in Express, and what is the significance of the order in which middleware is registered? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
5What is the purpose of the helmet middleware package for an Express application, and what specific security headers does it set? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
6What is CORS middleware in Express, and how does the cors package simplify configuring Cross-Origin Resource Sharing? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
7How do you write custom Express middleware that needs to perform asynchronous work, like checking a value against a database, before calling next()? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
8How would you implement request validation middleware in Express using a schema-validation library like Zod or Joi? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
9How would you implement a request-logging middleware in Express that captures method, path, status code, and response time for every request? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
10How would you implement conditional middleware in Express that only applies to certain requests based on a runtime condition? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced