Question: JavaScript - Build with Node.js Follow the instructions bellow for a good rate ---------------------------------------------------------------------------- package-lock.json { name: async-await, version: 1.0.0, lockfileVersion: 1, requires: true, dependencies:

JavaScript - Build with Node.js Follow the instructions bellow for a good rate

JavaScript - Build with Node.js Follow the instructions bellow for a good

---------------------------------------------------------------------------- package-lock.json

{ "name": "async-await", "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { "axios": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "requires": { "follow-redirects": "^1.3.0", "is-buffer": "^1.1.5" } }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { "ms": "2.0.0" } }, "follow-redirects": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", "requires": { "debug": "^3.1.0" } }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }

---------------------------------------------------------------------------- package.json

{ "name": "async-await", "version": "1.0.0", "description": "", "main": "app-promises.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "axios": "^0.18.0" } }

---------------------------------------------------------------------------- curreny-convert.js

const axios = require('axios');

const getExchangeRate = async (from, to) => { const response = await axios.get('http://data.fixer.io/api/latest?access_key=d32d75de5146611ae7f23de0782ac09b'); const euro = 1 / response.data.rates[from]; const rate = euro * response.data.rates[to]; return rate; };

const getCountries = async (currencyCode) => { const response = await axios.get(`https://restcountries.eu/rest/v2/currency/${currencyCode}`); return response.data.map((country) => country.name); };

const convertCurrency = async (from, to, amount) => { //implement the logic in here };

// Final solution call // convertCurrency('CAD', 'PLN', 20).then((message) => { // console.log(message); // });

//Testing methods below, remove in final solution

getExchangeRate('CAD', 'PLN').then((rate) => { console.log(rate); });

getCountries('PLN').then((countries) => { console.log(countries); });

.Create a currency converter using the provided start package files The final output of the program should be: 20 CAD is worth 56.50 PLN. You can spend it in the following countries: Poland", where bold indicates variables One point if you can make it work for currencies that are only in one country (e.g Poland), two points if you can format correctly the output for currencies available in multiple countries, e.g.: .20 CAD is worth 1.,26 USD. You can spend it in the following countriesi American Samoa, Bonaire, Sint Eustatius and Saba, British Indian Ocean Territory, United States Minor Outlying Islands, Virgin Islands (British), Virgin Islands (U.S.), Cambodia, Ecuador, El Salvador, Guam, Marshall Islands, Micronesia (Federated States of), Northern Mariana Islands, Palau, Panama, Puerto Rico, Timor-Leste, Turks and Caicos Islands, United States of America, Zimbabwe" .Create a currency converter using the provided start package files The final output of the program should be: 20 CAD is worth 56.50 PLN. You can spend it in the following countries: Poland", where bold indicates variables One point if you can make it work for currencies that are only in one country (e.g Poland), two points if you can format correctly the output for currencies available in multiple countries, e.g.: .20 CAD is worth 1.,26 USD. You can spend it in the following countriesi American Samoa, Bonaire, Sint Eustatius and Saba, British Indian Ocean Territory, United States Minor Outlying Islands, Virgin Islands (British), Virgin Islands (U.S.), Cambodia, Ecuador, El Salvador, Guam, Marshall Islands, Micronesia (Federated States of), Northern Mariana Islands, Palau, Panama, Puerto Rico, Timor-Leste, Turks and Caicos Islands, United States of America, Zimbabwe

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!