rwieruch / node-express-server-rest-api

Basic Node with Express Server with REST API
https://www.robinwieruch.de/
120 stars 132 forks source link

feat(put): add put endpoint and implementation to the message route #10

Closed A-nd-I closed 3 weeks ago

A-nd-I commented 3 weeks ago

Description

This PR introduces a new PUT method for updating existing records in the Messages array, enhancing the RESTful capabilities of the API. This update allows users to modify the contents of messages.

Changes

Specifics of the New Feature

The new PUT method enables users to update an existing message by sending a request to http://localhost:3000/messages/:messageId. The method expects data in x-www-form-urlencoded format with the updated text field of the message. It responds with the updated message data, including text, id, and userID.

How to Test the Feature

To test the new feature using Postman:

  1. Open Postman and set up a new PUT request to http://localhost:3000/messages/1.
  2. In the Body of the request, choose x-www-form-urlencoded.
  3. Add the key text and enter the updated message text as the value, for example:
rwieruch commented 3 weeks ago

That's great. Thanks!