Grokking Node.js
Vote

0% completed

​

Handling Requests and Responses

Every request that reaches a Node.js server is described by the req object, and every reply is built on the res object. The req object carries four things: the method, the URL, the headers, and a body that may still be arriving over the network. The res object sets a status code and headers, then sends a body.

This lesson builds one small server that uses all four parts of the request. By the end it answers GET /hello?name=Alice with a greeting and POST /echo with the JSON it received.

Method, URL and headers

The first three parts are ready as soon as your handler runs. `req

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content