Question: The code developed for the DELETE method in the lecture does not validate the request pathname against wrong input. In this activity you need to
The code developed for the DELETE method in the lecture does not validate the request
pathname against wrong input. In this activity you need to update the code to account for the
following
Mapping the index arriving from the clientside to the correct index on the serverside.
ie if the client sends the following curl request,
curl X DELETE localhost:
the first item at index will be deleted rather than the second item at index
Accounting for a missing index. ie if the client sends the following curl requests
curl X DELETE localhost: or curl X DELETE localhost:
the server replies with
Missing index for item to be deleted
Working with lists that could have indices that are more than one digit number. So far,
the code can handle indices between and Adjust the code to handle indices from
to
Accounting for an invalid value for an index. ie if the client sends the following curl
request
curl X DELETE localhost:a
the server replies with
invalid item index
Hint: The JS function Number.isNaN static method determines whether the passed
value is the number value NaN, and returns false if the input is not of the Number type.
After completing the above modifications, upload the updated todoSrv. js to BB
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
