The request module is used to make HTTP calls. It is the simplest way of making HTTP calls in node.js using this request module. It follows redirects by default.
Feature of Request module:
- It is easy to get started and easy to use.
- It is widely used and popular module for making HTTP calls.
Installation of request module:
- You can visit the link Install Request module. You can install this package by using this command.
npm install request
- After installing request module you can check your request version in command prompt using the command.
npm version request
- After that, you can create a folder and add a file for example index.js, To run this file you need to run the following command.
Steps to run the program:
- The project structure will look like this:
- Make sure you have install express and request module using following commands:
npm install request
npm install express
- Run index.js file using below command:
So this is how you can use the request module for making HTTP calls. It is very simple and easy to use.
- HTTP Request vs HapiJS Request in Node.js
- Nodejs | Automatic restart NodeJs server with nodemon
- How to send a GET request from PHP?
- HTTP headers | Access-Control-Request-Headers
- HTTP headers | Access-Control-Request-Method
- Simple POST request using the fetch API
- Node.js | https.request() Function
- DELETE request using XMLHttpRequest by making Custom HTTP library
- Express.js | app.get() Request Function
- Get request using AJAX by making Custom HTTP library
- POST request using AJAX by making Custom HTTP library
- How to make PUT request using XMLHttpRequest by making Custom HTTP library ?
- Simple GET and POST request using Fetch API method by making custom HTTP library
- How to make simple PUT request using fetch API by making custom HTTP library ?
- Simple DELETE request using fetch API by making custom HTTP library
- How HTTP POST request work in node.js ?
- Node.js request.socket Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.