1.2.0 • Published 7 years ago
curry_conv v1.2.0
curry_conv
A Node.js command-line interface app for converting currencies.
To run this tool, you must obtain a key from Open Exchange Rates. This is easy and doesn't require that you give credit card info.
System Requirements
- The database needs to be running. For more info on installing and setting up MongoDB, visit Install MongoDB Community Edition
Dependencies
For details, see the package.json file.
- Command line interface is supported by
commanderandinquirermodules - API access depends on the
requestanddotenvmodules - Conversion record validation an storage depends on
mongoosemodules - CSV export uses
json2csvand Node's Core File System modules - Multiple formatting modules were used to improve terminal output readability (
columnify,currency-symbol-map,moment, andpluralize)
Installation Steps
- Clone the currency converter repo and move into the currency_converter directory.
git clone https://github.com/gingin77/currency_converter.git
cd currency_converter- To access the executable
currycommand, you'll need to run a global npm install, which may or may not require you to usesudo:
currency_converter $ sudo npm i -g- You should now be able to run
curry --helpto see a list of options. Using a browser, sign up for a free account at openexchangerates.org and obtain an API key.
Copy the .env.sample to a new .env file
cp .env.sample .env- Open your
.envfile and replace the dummy string with the API key obtained from Open Exchange Rates.
# .env
OPEN_EXCHANGE_KEY = 235233_your_actual_key_goes_here_53531513346713476Options
currency_converter $ curry --help
Usage: curry [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
convert Prompts user to submit currency types and a value to convert
last-one Retrieves a record of the last conversion
last-ten Retrieves up to 10 of the most recent conversions
query-currency Returns up to 10 records for a selected converted-to currency
csv-export Allows ALL historical conversions to be exported to a .csv fileTroubleshooting
If you see null after Getting exchange rates.... as shown in the example below, you are not connecting with the Open Exchange Rates API and likely need to add your key to the .env file.
currency_converter $ curry convert
? Choose a base currency type to convert from: United States Dollar
? Choose a currency type to convert to: Brazilian Real
? How much do you want to convert? 78900
Getting exchange rates...
null