GET Method

Will be managing this data: In data.js

Screenshot 2022-08-30 at 3.45.35 PM.png

Screenshot 2022-08-30 at 3.48.50 PM.png

Screenshot 2022-08-30 at 3.49.52 PM.png

POST method

Form example (HTML):

Now, I will use post on same data. The files that are needed for this are provided in the github repo.

We will use the methods-public folder like this:

Screenshot 2022-08-30 at 3.56.22 PM.png

This will give us the basic code that is needed, for the UI.

Screenshot 2022-08-30 at 3.57.11 PM.png

Screenshot 2022-08-30 at 5.16.23 PM.png

In the form the action is ‘/login’ and the method is POST. This is a form for POST request.

If I try to simply send the post request:

Screenshot 2022-08-30 at 5.19.03 PM.png

This is because I have not made the /login API yet. So, in the console:

Screenshot 2022-08-30 at 5.20.04 PM.png

You can see we got 404 Not Found.