Code, Maker, Robotic, Open Source. Knowledge Bases

Replacing the deprecated request module

Request module is deprecated and not longer maintenance and update by Mikeal Rogers.

I have been using Request module very long times. Almost every NodeJS developer have use using this popular module.

request is also the first package on npm package and is the also first module use on my NodeJS production module.

The main reason Request module is deprecated because the request module code structure is older many latest javascript feature is not supported For example, async/await feature and the main reason is the vulnerability threats will cause many security .

Update the whole new structure of module will take a longer times and on npm have many other module can replace request module so the module author is not longer maintenance the module.

First let take a long how the request module working.

request module

var request = require('request');

function requestModule()  
    request('', function (error, response, body) {
      console.log('statusCode:', response && response.statusCode);
      console.log('error:', error );
      console.log('body:', body );


Let try the most popular HTTP module axios

axios module

const axios = require('axios');

function axiosModule()  
  .then(function (response) {
    // handle success
  .catch(function (error) {
    // handle error
  .then(function () {
    // always executed


Also let have a look the Human-friendly and powerful HTTP request library for Node.js

got module

const got = require('got');

function gotModule()  
  (async () => {
      try {
          const response = await got('');
      } catch (error) {


After some test axios Module is more suitable for my current project.
axios module not only available on NodeJS also available on frontend Browser support.
On new project maybe will try to use got module regarding got module have more feature support compare with axios.