Question: Activity 3 : Completing the GET Method In this activity you are required to fill in the code for GET method to display the To

Activity 3: Completing the GET Method
In this activity you are required to fill in the code for GET method to display the To-Do-list as a
numbered list starting from index 1.
Check the length of the To-Do List. If the To-Do List is empty, then the GET method will
respond with the message "Your To-Do list is empty. Well Done!!!"
If the To-Do List has items, then create a string list by concatenating all entries in the To-Do
List. To create the list use either map() and join() or forEach() as you have done in
Activity 1.
Send the response to the client by calling res. end () using the appropriate message.
Check a sample run for the GET method below. The server responses are colored green.
Note that section 4.2 in the book implements the GET method. However, you will need to
make some adjustments to the book's implementation to get the Sample Run below.
After testing the server, upload the updated todoSrv.js to BB.
Sample Run for GET method:
hhassa2@L-MAC-N04091 Chapter4% curl -d 'buy the books' localhost:8080
OK
hhassa2@L-MAC-N04091 Chapter4% curl localhost:8080
buy the books%
hhassa2@L-MAC-N04091 Chapter4% curl -d 'Complete lab 2' localhost:8080
OK
hhassa2@L-MAC-N04091 Chapter4% curl -d 'go to the dentist' localhost:8080
OK
hhassa2@L-MAC-N04091 Chapter4% curl localhost:8080
buy the books
Complete lab }
go to the dentist%
hhassa2@L-MAC-N04091 Chapter4% curl -X DELETE localhost:8080/1
OK
hhassa2@L-MAC-N04091 Chapter4% curl localhost:8080
Complete lab 2
go to the dentist%
hhassa2@L-MAC-N04091 Chapter4% curl -X DELETE localhost:8080/2
OK
hhassa2@L-MAC-N04091 Chapter4% curl localhost:8080
Complete lab 2%
hhassa2@L-MAC-N04091 Chapter4% curl -X DELETE localhost:8080/1
OK
hhassa2@L-MAC-N04091 Chapter4% curl localhost:8080
Your To-Do list is empty. Well Done!!!%
Activity 3 : Completing the GET Method In this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!