1.2.1 • Published 5 years ago

invoke-service v1.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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' })
1.2.1

5 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago