Get started with request-promise CDN

ISC licensed

Request-Promise is a Node.js library for sending and handling HTTP promises.

Tags:
  • xhr
  • http
  • https
  • promise
  • request
  • then
  • thenable
  • bluebird

Stable version

Copied!

How to start using request-promise CDN


const Request = require('request-promise');

const getJson = async (url) => {
  try {
    const options = { uri: url, json: true };
    const json = await Request(options);
    return json;
  } catch (err) {
    console.log('Error:', err.message);
  }
};

(async () => {
  const url = 'https://jsonplaceholder.typicode.com/todos/1';
  const json = await getJson(url);
  console.log(json);
})();
Copied!
Copied!

All versions