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
Added a PUT route in src/routes/message.js.
Implemented the corresponding handler for updating messages in memory.
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:
Open Postman and set up a new PUT request to http://localhost:3000/messages/1.
In the Body of the request, choose x-www-form-urlencoded.
Add the key text and enter the updated message text as the value, for example:
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
PUT
route insrc/routes/message.js
.Specifics of the New Feature
The new
PUT
method enables users to update an existing message by sending a request tohttp://localhost:3000/messages/:messageId
. The method expects data inx-www-form-urlencoded
format with the updatedtext
field of the message. It responds with the updated message data, includingtext
,id
, anduserID
.How to Test the Feature
To test the new feature using Postman:
http://localhost:3000/messages/1
.x-www-form-urlencoded
.text
and enter the updated message text as the value, for example: