GET Method
The get method is a kind of HTTP request that a client makes to request some data from the server. Suppose we are creating a weather application. In order to get data about the weather, the client will make a get request from the server to get data.
The get method comes with two parameters: the first is the URL, which means the URL for which the method is listening, and the second is the callback function, where that particular callback function takes two default arguments: one is a request made by the client, and the other is a response that will be sent to the client.
Syntax:
app.get("URL",(req,res)=>{})
Express JS HTTP Methods
In this article, we are going to learn about the different HTTP methods of Express JS. HTTP methods are hypertext transfer protocol methods to exchange data between two or more layers of an application using a request and response cycle.
In web development, we use HTTP methods to connect client-side code to server-side code and databases. The database for a particular website is too large, so it is not possible to store the database on the client side. That’s why we implement a server and setup different HTTP routes through which we can exchange data from the client side to the server side.
Table of Content
- GET Method
- POST Method
- PUT Method
- DELETE Method
Contact Us