RunKit + npm: forexy

node v14.17.0
endpointsharetweet
const Forexy = require("forexy") const currencyCheck = new Forexy(); currencyCheck.on("request", (data) => { //called before the request is made, returns the currency pair console.log(`'request' event triggered, with: ${data}`); }); const currency = async (pair) => { try { let result = await currencyCheck.get(pair).then((rate) => rate); return(`${currencyCheck.pair} rate ${Date(currencyCheck.timestamp)} is ${result}`); } catch (err) { return(`Error: ${err}`); } }; currency("USD NZD");
Created from: https://npm.runkit.com/forexy
Loading…