The getExchangeRate function

To do that, over inside Atom, we're going to kick things off by creating a const axios; we're going to require axios, and then we're going to make const for one of our two functions. This is for the first endpoint getExchangeRate. Now, getExchangeRate is going to take two pieces of information: the from currency code and the to currency code:

// USD CAD 23// 23 USD is worth 28 CAD. You can spend these in the following countries:const axios = require('axios');const getExchangeRate = (from, to)

This is going to be a function. All we're going to do is use axios. That's axios.get, and we're going to pass in that URL that I just copied from the browser:

// USD CAD 23// 23 USD is worth 28 CAD. You can spend these in ...

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.