Socket
Book a DemoInstallSign in
Socket

invoke-service

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

invoke-service

Invoke helper for http(s) services

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

NPM Version node Build Status js-standard-style

invoke-service

Invoke helper for http(s) services

Installation

Install from NPM:

$ npm install invoke-service --save

Examples

const { service, invoke } = require('invoke-service')

const weather1 = await invoke('https://weather.tld/v2/foo/bar', { latitude: 30, longitude: -130 })

const getWeather = service('https://weather.tld/v2/foo/bar')
const weather2 = await getWeather({ latitude: 30, longitude: -120 })


const fetchBlock = service('https://blockexplorer.com/api/block/:blockHash')
const block = await fetchBlock({ blockHash: '00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048' })

const authToken = '~34tmnku7bufyvfsvdytfycvasknclsdg'
const fetchTx = service('https://domain.tld/api/tx/:txHash', {
  token: authToken,
  heartbeat: 'https://domain.tld/api/ping'
})

const tx = await fetchTx({ txHash: '88018bb271d5af74feff1b0f4946f93c582e87a8aeffcdb4e9dbd0e4a67d3a4b' })

Keywords

microservices

FAQs

Package last updated on 05 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts