The http.ServerResponse Object
The HTTP server creates the ServerResponse object internally when it receives a request event. This object is passed to the request event handler as the second argument. You use the ServerRequest object to formulate and send a response to the client.
The ServerResponse object implements a Writable stream, so it provides all the functionality of a Writable stream object. For example, you can use the write() method to write to the ServerResponse object as well as pipe a Readable stream into it to write data back to the client.
When handling the client request, you use the properties, events, and methods of the ServerResponse object to build and send headers; write data; and send the response. Table 7.5 lists the event ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access