Development
...
API Reference
Http Module
3 min
api reference https //signum network github io/signumjs/modules/http html npm package https //www npmjs com/package/@signumjs/http cdn url https //cdn jsdelivr net/npm/@signumjs/crypto\@1 0 0 rc 31/dist/signumjs crypto min js https //cdn jsdelivr net/npm/@signumjs/http/dist/signumjs http min js iife namespace sig$http installation npm npm i @signumjs/http yarn yarn add @signumjs/http \<script/> basic usage the http module is a thin wrapper around the isomorphic http library https //github com/axios/axios it mainly unifies responses such that its use is consistent const {httpclientfactory} = require('@signumjs/http') function formatcurrency(value) { return (value) tofixed(4) } async function checksignumticker() { try { // create your client using the factory const coingeckoclient = 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) } } (async () => { await checksignumticker(); })(); \<script/> 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();