1.0.3 • Published 2 years ago

ma-https-services v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ma-https-services

ma-https-services is a package to be used by mobilearts to call apis and store their logs in S3 and ES.

Function

  • callApi(data)

Installation

Install the dependencies.

cd yourpath
npm i ma-https-services

Usage

After installation add requirment to your code

const MA_Https = require('ma-https-services');
const httpsServices = new MA_Https();

Fields

required: hostname OR url

optional: pathname "" protocol (default "https") method (default "GET") params {} headers {} body "", {}

Example 1:

var data = 
{
    "url" : "https://wtv.com/path1",  
    "params": {"param1":1, "param2":2},
    "headers": {"Content-type":"application/x-www-form-urlencoded"},
    "method" : "POST" 
}
httpsServices.callApi(data)

Example 2:

var data = 
{
    "hostname" : "wtv.com", 
    "protocol" : "http",
    "pathname" : "path1",
    "params": {"param1":1, "param2":2},
    "headers": {"Content-type":"application/x-www-form-urlencoded"}

}
httpsServices.callApi(data)
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago