Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

Express.js GET Request

GET and POST both are two common HTTP requests used for building REST API's. GET requests are used to send only limited amount of data because data is sent into header while POST requests are used to send large amount of data because data is sent in the body.

Express.js facilitates you to handle GET and POST requests using the instance of express.


Express.js GET Method Example 1

Fetch data in JSON format:

Get method facilitates you to send only limited amount of data because data is sent in the header. It is not secure because data is visible in URL bar.

Let's take an example to demonstrate GET method.

File: index.html

File: get_example1.js

Get Request 1

Open the page index.html and fill the entries:

Get Request 2

Now, you get the data in JSON format.

Get Request 3 Get Request 4

Express.js GET Method Example 2

Fetch data in paragraph format

File: index.html

File: get_example2.js

Get Request 5

Open the page index.html and fill the entries:

Get Request 6

Output:

Get Request 7

Express.js GET Method Example 3

File:index.html

File: get_example3.js

Get Request 7 Get Request 8 Get Request 9
Next TopicExpressJS POST




Latest 4 Tutorials on JavaTpoint