O'Reilly logo

Express.js Deep API Reference by Azat Mardan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 6

image

Response

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 do 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, such as

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required