Request, Response, and Status Codes
Explore the fundamentals of API requests and responses and the NestJS request life cycle.
We'll cover the following
Request-response model
The request-response model is a communication pattern where a client sends an HTTP request to a server, and the server processes the request and returns an HTTP response containing the requested data. This model forms the core mechanism for client-server interactions in REST architecture, allowing clients to request resources or trigger actions on the server via well-defined API endpoints.
This lesson will explore the request-response model in the context of NestJS and RESTful API development.
Request
An HTTP request is a mechanism for a client to interact with the resources from the server. HTTP works based on the request-response model.
Below is a request and response example—a client app requests a to-do list from a RESTful API server, and the server returns a response with a list of to-do items in JSON format.
Get hands-on with 1400+ tech skills courses.