What does the Node.js http module provide?
http.createServer for creating servers, http.request for making requests, and the IncomingMessage (request) and ServerResponse (response) objects. It is the foundation that Express and other frameworks build on.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in The Node.js http Module Explained: Requests, Responses, and Servers
The request body is a readable stream. Listen to 'data' events for chunks and 'end' for completion. For JSON, concatenate chunks and JSON.parse the result. This is how Express body parsing works under the hood.
Because without end, the response is never finished and the request hangs. The client waits indefinitely. Always call response.end after sending the body, even if the body is empty.
Yes. The request body is a readable stream, and the response is a writable stream. This means large bodies are processed in chunks, keeping memory low, which is essential for large uploads or downloads.
Still have questions?
Browse all our FAQs or reach out to our support team
