Http Module
3 min

API Reference | |
|---|---|
NPM Package | |
CDN URL | |
IIFE namespace | sig$http |
Installation
npm i @signumjs/httpBasic Usage
The Http Module is a thin wrapper around the isomorphic HTTP library axios. It mainly unifies responses such that its use is consistent
async function checkSignumTicker() {
try {
// create your client using the factory...
const coingeckoClient = sig$http.HttpClientFactory.createHttpClient("https://api.coingecko.com/api/v3/coins")
// make your request with the relative url
const {response} = await coingeckoClient.get('signum?tickers=false&community_data=false&developer_data=false&market_data=true')
console.info(formatCurrency(response.market_data.current_price.btc * 10e7), ' SATS (BTC)')
console.info(formatCurrency(response.market_data.current_price.usd), ' USD')
console.info(formatCurrency(response.market_data.current_price.eur), ' EUR')
} catch (e) {
// if the request fails the error is of type HttpError
console.error(e)
}
}
checkSignumTicker();