Create the POST, PUT, and DELETE Endpoints

Learn how to create the POST, PUT, and DELETE endpoints.

Implement the POST, PUT, and DELETE endpoints

In this lesson, we’ll learn how to create and configure the POST, PUT, and DELETE endpoints, allowing us to handle data creation, updates, and deletions in the NestJS application.

At a high level, adding an endpoint involves the following two key steps:

  • Defining the service method to handle the HTTP request (for example, POST, PUT, and DELETE).

  • Adding the endpoint and specifying the route where the method should be accessible.

These steps are fundamental to building a well-structured and functional API.

The POST endpoint

First, let’s add a create method into AddressService.

Get hands-on with 1400+ tech skills courses.