- The HTTP Module
- Working with the Request Body
- Managing HTTP Responses
- Handling File Uploads with Formidable
- The "axios" Package
Node.js comes with a built-in HTTP module that provides a flexible, robust API. It allows you to:
- Create a server
- Work with streamed data
- Make API calls
This is done without any external dependencies.
request.url
request.method
request.headers
Recap:
- Request headers, URL, and method are available immediately.
- The request body needs to be fully received.
- Buffers are like small packages of information.
- The "request" object utilizes two interfaces:
- ReadableStream
- EventEmitter
- Set status code
- Set headers
- Write data
- Close connection
- Operate on data one piece at a time
- Memory efficiency
- Time efficiency
error.code
error.message
error.stack
- Fast (~500mb/sec)
- Automatically writes to disk
- Low memory footprint
- Graceful error handling
- Very high test coverage
- Well-maintained
- Works client and server-side
- Streaming
- Promise-based API
- Automatic transformation of data into JSON