Perform request with promise based client on NodeJS
Smoothly request enables developer to send request with promise based client on NodeJS. The package generally was designed for cloud functions (aws lambda, google functions etc.), and it has a little unpacked size.
Using npm:
$ npm install smoothly-requestPerforming a GET request
const smoothlyRequest = require('smoothly-request');
(async () => {
const result = await smoothlyRequest({
hostname: `https://ahmetonursolmaz.com.tr`,
path: '/users/2',
method: 'GET'
});
})();Performing a POST request
const smoothlyRequest = require('smoothly-request');
(async () => {
const result = await smoothlyRequest({
hostname: `https://ahmetonursolmaz.com.tr`,
path: '/users',
method: 'POST',
payload: {},
});
})();Performing an another request
const smoothlyRequest = require('smoothly-request');
(async () => {
const result = await smoothlyRequest({
hostname: `https://ahmetonursolmaz.com.tr`,
path: '/users/2',
method: 'PATCH',
payload: {},
});
})();
(async () => {
const result = await smoothlyRequest({
hostname: `https://ahmetonursolmaz.com.tr`,
path: '/users/2',
method: 'DELETE',
payload: {},
});
})();