Skip to content
Share
Explore

Request & Response

Request

Is a JSON object. Important:
url: string after domain:
method: GET, POST...
headers: object contain...
host
cache-control
user-agent (browser)
accept
cookie
All kind of headers for reference:

Response

Simple

Under-the-hood Request & Response

Request Body is sent as Stream of Data
maybe a file, or an object, or string...
Request Body is broken into chunks
use af Buffer (Buffer holds multiple chunks)
On fully parsed, convert the data
can’t work with data instantly
This is a RAW logic, will eventually use Express to solve this complex.
IMG_1387.jpeg

Event-driven Execution

Back to async, await, promise things
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.