JavaScript REST APIs with Express Create, Read, Update, Delete Edit A Quote

Kelvin Chen
Kelvin Chen
5,152 Points

How does the server know the request HTTP verb

The video explains that making request from Postman with PUT or POST requests. But if I am making the PUT or POST request from the browser with the same routing, how does the server know what kind of request I am making? And how do I send a JSON object with my requests in the browser?

1 Answer

Zimri Leijen
Zimri Leijen
6,636 Points

Express abstracts those things away, but whenever you make a request to the server, a lot of data is sent, along with that data is a header, which contains information like the type of request ('PUT', 'GET', etc..).

By default, a request is a 'GET' request, but when you make an interactive element on a website (usually a form or a button) you can specify the type of request being sent.

A form is often a 'POST' request for example (but not always).

I believe this course gives a bit more insight into it.