Day 23 of 100days of code.

Fundamentals of node JS
Handling DELETE Request
Lets create a new route handler for handling the DELETE request on the HTTP server. Lets write some logic. first we want to get the ID of the movie using the find() method, then we get the index of the movie using the indexOf() method, Then we use the splice() method to remove or delete the movie from our movies array๐๐ผ

Lets see the server response๐๐ผ

The movie was also removed or deleted from our movies.json file๐๐ผ

Lets refactor the code base for cleaner code. ๐๐ผ

We can also refactor the endpoints as well from this ๐๐ผ

To this ๐๐ผusing the route() method chaining the different HTTP method using the endpoint.

That's all for this lesson.
Next: Understanding Middleware
See you soon๐๐ซกโ๐ผ...




