PUT method endpoints

The last method is PUT, and it is usually used to update a row in a database.

PUT /post/:slug

In Postman, you need to select the PUT method first, then the URL of the post you want to edit. Let's edit my-blog-post-3; so the URL will be http://localhost:3000/api/post/my-blog-post-3. In the Headers tab, you need to add, as in the POST method, the Content-Type header with the value application/x-www-form-urlencoded. The last part is the Body tab, where you can send the new data you want to replace, in this case, a new title and new content:

If everything works fine, you should get this response:

Again, if you want to verify ...

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.