Skip to content

ahmetonurslmz/smoothly-request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Dependencies devDependencies install size npm version

Smoothly request

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.

Installing

Using npm:

$ npm install smoothly-request

Example

Performing 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: {},
    });
})();