This project utilizes a simple nodejs express backend which is hosted on Vercel to hide the API credentials. To run the project locally, follow the steps below:
- First generate your own API keys from Currencybeacon
- Fork and clone the project to your machine.
- Rename
.env.example
in theserver
directory to.env
- Insert your API keys
- Run the commands below
cd server
npm install
npm start
This should start the backend server on localhost:5000
With the server running, you can now run the converter locally,
- Rename
.env.example
to.env
- Set
VITE_API_URL
to the hosted backend URL (Only relevant for production) - Run the commands below
npm install
npm run dev
Now you can visit localhost:5173 to see the project live.
- Visit localhost:5000/currency to see the currency list
- Visit localhost:5000/convert to perform a conversion
Important
The convert endpoint takes in three parameters, a base currency code base
, a foreign currency code foreign
, and the amount
you would like to convert.
Example endpoint
http://localhost:5000/convert?base=USD&foreign=NGN&amount=1
This should return an object that contains the conversion details.
If you notice any bugs or errors, kindly raise an issue to discuss it. Contributions are also welcome.
The converter is powered by the CurrencyBecacon API, which supports over 161 commonly circulating world currencies listed here. These cover 99% of all UN recognized states and territories.
The flags used are embedded using Flagcdn which offers countries images based on their code.