PUT method endpoints

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

PUT /post/:slug. In Postman you need to select the PUT method, then the URL of the post you want to edit. Let's edit my-blog-post-3; the URL will be http://localhost:3000/api/post/my-blog-post-3. On the Headers tab, like in the POST method, you need to add a Content-Type header with the value application/x-www-form-urlencoded. In the Body tab, you 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 the post was updated correctly ...

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.