All fields

“Express & Middleware” in Information Technology

32 questions across 2 technologies.

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
11How would you implement a global request timeout middleware in Express to prevent a slow request from hanging indefinitely? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
12What is Express.js, and what problem does it solve compared to using Node.js's raw http module directly? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareBeginner
13What is the difference between res.send(), res.json(), and res.end() in Express, and when should each be used? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareIntermediate
14How would you structure a large Express application using the Router to organize routes into feature-based or resource-based modules? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
15How would you implement a middleware that adds a correlation/request ID to every incoming request for tracing purposes across a distributed system? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced
16What is the Middleware (Chain of Responsibility) pattern as implemented by Express, and how does the 'next()' function drive it? Node.js › Architecture & Design PatternsNode.jsArchitecture & Design PatternsIntermediate
17What is Role-Based Access Control (RBAC), and how would you implement it as Express middleware? Node.js › Authentication & AuthorizationNode.jsAuthentication & AuthorizationIntermediate
18What is a centralized error-handling middleware pattern in Express, and what advantages does it provide over handling errors in each individual route? Node.js › Error HandlingNode.jsError HandlingAdvanced
19What is multipart/form-data, and why does a Node.js server need special middleware (like multer) to handle file uploads? Node.js › File Uploads & Media ProcessingNode.jsFile Uploads & Media ProcessingBeginner
20How would you create a basic HTTP server using only Node's built-in node:http module, without a framework like Express? Node.js › HTTP & HTTPS ModulesNode.jsHTTP & HTTPS ModulesBeginner
21Why doesn't Express automatically catch errors thrown inside an async route handler in versions prior to Express 5, and how do you work around this? Node.js › Error HandlingNode.jsError HandlingIntermediate
22How would you implement a global 'not found' (404) handler in Express for any route that doesn't match a defined endpoint? Node.js › Error HandlingNode.jsError HandlingIntermediate
23What is a layered (n-tier) architecture in a Node.js/Express application, and what are its typical layers? Node.js › Architecture & Design PatternsNode.jsArchitecture & Design PatternsAdvanced
24How do you write a custom IValidateOptions<T> implementation for validation logic beyond what DataAnnotations attributes can express? ASP.NET Core › Configuration & Options PatternASP.NET CoreConfiguration & Options PatternAdvanced
25How would you create a basic HTTP server in Node.js using only the built-in node:http module, without any framework? Node.js › HTTP & Web ServersNode.jsHTTP & Web ServersBeginner
26What is Passport.js, and how do its 'strategies' provide a consistent authentication abstraction across different methods? Node.js › Authentication & AuthorizationNode.jsAuthentication & AuthorizationIntermediate
27What is CSRF (Cross-Site Request Forgery), and how do you protect a Node.js session-based application against it? Node.js › Authentication & AuthorizationNode.jsAuthentication & AuthorizationIntermediate
28How would you validate and restrict uploaded file types and sizes using multer to prevent malicious or oversized uploads? Node.js › File Uploads & Media ProcessingNode.jsFile Uploads & Media ProcessingIntermediate
29What is the difference between upload.single(), upload.array(), and upload.fields() in multer? Node.js › File Uploads & Media ProcessingNode.jsFile Uploads & Media ProcessingIntermediate
30What is the purpose of the HTTP OPTIONS method, and how does it relate to CORS preflight requests? Node.js › HTTP & Web ServersNode.jsHTTP & Web ServersIntermediate
31How do JWTs, OAuth, and Passport.js fit together in a typical Node.js authentication architecture? Node.js › Authentication & Authorization (JWT, OAuth, Passport)Node.jsAuthentication & Authorization (JWT, OAuth, Passport)Intermediate
32How would you optimize a Node.js application's JSON serialization performance for API responses with very large or very frequent payloads? Node.js › Performance Optimization & ProfilingNode.jsPerformance Optimization & ProfilingAdvanced