From 39ac08ccb35d1d0e6400e3e8e5c690fe8ae68857 Mon Sep 17 00:00:00 2001 From: Andrej Rasevic <andrej@rasevicengineering.com> Date: Tue, 18 Jan 2022 17:05:02 -0500 Subject: [PATCH] more updates --- exercises/exercise3/InMemoryApi/routes/api/v1/contacts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/exercise3/InMemoryApi/routes/api/v1/contacts.js b/exercises/exercise3/InMemoryApi/routes/api/v1/contacts.js index 6f0c60d..225e2a0 100644 --- a/exercises/exercise3/InMemoryApi/routes/api/v1/contacts.js +++ b/exercises/exercise3/InMemoryApi/routes/api/v1/contacts.js @@ -6,7 +6,7 @@ You will need to define the following routes: contacts in your application and a response code of 200 2) POST: it will respond to a POST request that will generate a new instance of a contact and add it to the in memory collection - and a response code 201 + and a response code 201 and a message saying "successfully added contact". 2) /api/v1/contacts/:id This route will need to responde to 4 requests: 1) GET: it will respond with the serialized form of the requested @@ -21,12 +21,13 @@ You will need to define the following routes: conditions, e.g. if you are passing values for both the firstName and lastName then your matches need to match both query parameters. Note: query params end at the end of the route, and all come after the ? character and are combined with a &. + /api/v1/contacts/:id 3) PUT: it will update the resource with the information attached in the req.body property. Your route should respond with a 201 response code along with the updated resource otherwise 404 with an error message of "unable to update resource". 4) DELETE: it will remove the contact from the collection with the matching id - in the request.params object and respond with a status code of 201 alone with + in the request.params object and respond with a status code of 201 along with the deleted resource in the response. If the resource is not found the route should respond with a 404 error and message "resource not found". -- GitLab