Node.js https.request() Function Last Updated : 19 Sep, 2024 Comments Improve Suggest changes Like Article Like Report Https request function in Node is used to make the http request over secure http or https. It provide more control to the request like setting headers, http methods, adding request data and handle the responses.https.request(options, callback)It is a part of https module and allows to send different requests like GET, POST,, PUT, DELETE etc. to interact with the web servers.Feature of https moduleIt is easy to get started and easy to use.It is widely used and popular module for making https calls.Example: The example uses https.request funtion to make GET request to the API and console log the data. JavaScript // Filename: index.js const https = require('https'); // Sample URL const url = 'https://jsonplaceholder.typicode.com/todos/1'; const request = https.request(url, (response) => { let data = ''; response.on('data', (chunk) => { data = data + chunk.toString(); }); response.on('end', () => { const body = JSON.parse(data); console.log(body); }); }) request.on('error', (error) => { console.log('An error', error); }); request.end() Steps to run the program: Run index.js file using below command: node index.js So this is how you can use the https.request() function to make https request calls.Summaryhttps.request is a part of https module and is used to make request using https i.e. secured http with the web servers. It allow to make GET, POST, PUT, DELETE requests along with headers, request datga and handle responses. Comment More infoAdvertise with us Next Article Node.js https.request() Function G gouravhammad Follow Improve Article Tags : JavaScript Web Technologies Node.js NodeJS-function Similar Reads Node.js http.ServerResponse.connection Method The httpServerResponse.connection is an inbuilt application programming interface of class Server Response within http module which is used to get the response socket of this HTTP connection. Syntax: response.connection Parameters: This method does not accept any argument as a parameter. Return Valu 2 min read Node.js http.ClientRequest.connection Property The http.ClientRequest.connection is an inbuilt application programming interface of class ClientRequest within the HTTP module which is used to get the reference of underlying client request socket. Syntax: const request.connectionParameters: It does not accept any argument as the parameter. Return 2 min read How to make HTTP requests in Node ? In the world of REST API, making HTTP requests is the core functionality of modern technology. Many developers learn it when they land in a new environment. Various open-source libraries including NodeJS built-in HTTP and HTTPS modules can be used to make network requests from NodeJS.There are many 4 min read How HTTP POST requests work in Node ? The HTTP POST method is used to send data from the client to the server. Unlike GET, which appends data in the URL, POST sends data in the request body, which makes it ideal for form submissions, file uploads, and secure data transfers.In Node.js, handling POST requests is commonly done using the Ex 2 min read HTTP Request vs HapiJS Request in Node.js Node.js: Node.js is an open-source and cross-platform runtime environment for executing JavaScript code outside a browser. You need to remember that NodeJS is not a framework and itâs not a programming language. Most of the people are confused and understand itâs a framework or a programming languag 3 min read Like