Middlewares
|
|
Título del Test:![]() Middlewares Descripción: Information about Middlewares |



| Comentarios |
|---|
NO HAY REGISTROS |
|
What is middleware in backend development?. Software that connects two separate applications or services. A database that stores user information. A front-end framework for building user interfaces. Middleware only runs on the client side of an application. True. False. Middleware is often described as a __________ between the client request and the server response. barrier. bridge. destination. Middleware can perform actions such as authentication, logging, or data validation before sending the request to the main logic. True. False. In simple terms, middleware is... Code that connects and processes data between components in a system. Software that only handles database queries. A network protocol for sending HTTP requests. Which of the following components is typically part of a middleware function?. Request object, Response object, Next function. HTML template, CSS file, JavaScript script. Controller, Service, Database. Every middleware must always call the next() function to continue the request flow. True. False. In the middleware structure, what is the purpose of the next() function?. To send a final response to the client. To call the next middleware function in the stack. To initialize the server application. Which of the following correctly represents the basic structure of a middleware in Express.js?. function middleware(req, res, next) { /* logic */ }. function middleware(config) { return req, res; }. const middleware = (app) => { return new Server(); }. Middleware can exist globally or be applied only to specific routes or controllers. True. False. What is a middleware stack?. The ordered list of middleware functions that process a request. A data structure used to store user sessions. A queue that handles incoming emails. In middleware design, what is the purpose of separating logic into multiple middleware layers?. To make code modular, reusable, and easier to maintain. To reduce server memory usage. To remove asynchronous behavior. What is the most common way to implement middleware in Express.js?. Using the function app.use(). Writing a SQL query in the controller. Adding a <script> tag in the HTML. Middleware can be both synchronous and asynchronous depending on the task it performs. True. False. Which of the following correctly applies a middleware only to a specific route?. app.get('/user', userMiddleware, userController). app.use(userMiddleware). server.listen(userMiddleware). Middleware can be implemented as a separate reusable module or file. True. False. In a middleware function, what happens if you don’t call next() or send a response?. The request automatically completes. The request will hang and never reach the next middleware or route handler. The middleware restarts automatically. Which of the following is a good practice when implementing middleware?. Keep middleware small and focused on a single responsibility. Combine all functionalities into one large middleware function. Avoid separating middleware into files to reduce complexity. What is the main role of middleware in the request–response cycle?. To handle or modify requests before they reach the final route handler. To send database queries directly to the user. To replace the web server entirely. The request–response cycle starts when the client sends an HTTP request and ends when the server sends back an HTTP response. True. False. At which stage of the request–response cycle does middleware typically operate?. Before the route handler executes. After the response is sent to the client. Only when a database connection fails. What happens if none of the middleware or routes send a response back to the client?. The server automatically sends a default 200 OK response. The client waits indefinitely, resulting in a timeout. The request is retried automatically. |





