Question Bank
3705 approved questions from the community
How do you set response headers in Express.js?
Express.js supports streaming responses using the res.write() method.
In Express.js, calling `res.json()` automatically sets the Content-Type header to 'application/json'.
The `res.sendFile()` method requires an absolute path to the file.
You must manually parse JSON request bodies in Express.js without any middleware.
Express.js is synchronous and cannot handle asynchronous operations.
What method sends a JSON response in Express.js?
Which object in Express.js represents the HTTP request?
Which object in Express.js represents the HTTP response?
What file is typically the entry point for an Express.js application?
Using `res.send()` multiple times in the same route handler will send multiple responses to the client.
Error-handling middleware can recover from an error and continue processing the request by calling next() without arguments.
The order of route definitions in Express.js doesn't matter because Express matches all routes simultaneously.
Middleware defined with `app.use()` without a path will execute for every request including static file requests.
You can mount an Express application as a sub-application within another Express application.
Express.js automatically handles uncaught promise rejections in async route handlers.
How would you implement a logging middleware that tracks request processing time?
What is the best practice for handling asynchronous errors in Express.js route handlers?
In Express.js, if you call `next('route')`, it will skip to the next route handler, bypassing remaining middleware in the current route.
What is the benefit of using `express.Router` for organizing routes?