Request.js

The simplest and lightest Node.js module for sending Post or Get Requests.

You can use both HTTPS as well as HTTP for your own purposes.

Installation

npm install @surfy/request

Usage

The module will try to convert the received information into JSON. If it fails output Plain Text.
// Import library import request from "@surfy/request"; /* Request Options */ let options = { /* Full requested URL without queries */ url: "https://example.com", /* Request Method Values: "GET" or "POST" Default "POST" */ method: "GET", /* Query params Object or String Default {} */ params: { firstParam: "firstValue", secondParam: "secondValue" }, /* Authorization header Default False */ auth: "AUTH_STRING", /* Additional Headers Default False */ headers: { "-x-your-header-param": "Some value", /* You can override Content-Type Default "application/json" */ "Content-Type": "application/x-www-form-urlencoded" } }; /* Send Request Result: JSON, String or False if error has occurred */ let result = await request(options);

Contribution

If you like our project and would like to contribute to it or support us, feel free to contact us:
Alexander Yermolenko Surfy Founder
Get in Touch
Only major events and global updates