Express.js Response Object

The Express.js response object (res for short)—which is an argument in the request handler callbacks—is the same good old Node.js http.response object1 on steroids. This is because the Express.js response object has new methods. In other words, the Express.js response object is the extension of the http.response class.

Why would some use these additional methods? Indeed, you can use the response.end() method2 and other core methods, but then you’ll have to write more code. For example, you would have to add Content-Type header manually. But with the Express.js response object, which contains convenient wrappers, ...

Get Pro Express.js now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.