POST method endpoints

The POST method is typically used when we want to insert new data into our database.

POST /post. For this endpoint, we need to use Postman to send the data through the request body. To do this, you need to select the POST method in Postman. Enter the URL http://localhost:3000/api/post, then click on Headers, and you need to add a Content-Type header with a value of application/x-www-form-urlencoded:

After you set the header, go to the Body tab and select the raw option, and you can send the information like this:

Now you ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.