curry_conv

1.2.0 • Public • Published

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

  1. Node.JS
  2. MongoDB
  1. git

Dependencies

For details, see the package.json file.

  • Command line interface is supported by commander and inquirer modules
  • API access depends on the request and dotenv modules
  • Conversion record validation an storage depends on mongoose modules
  • CSV export uses json2csv and Node's Core File System modules
  • Multiple formatting modules were used to improve terminal output readability (columnify, currency-symbol-map, moment, and pluralize)

Installation Steps

  1. Clone the currency converter repo and move into the currency_converter directory.
git clone https://github.com/gingin77/currency_converter.git
cd currency_converter
  1. To access the executable curry command, you'll need to run a global npm install, which may or may not require you to use sudo:
currency_converter $ sudo npm i -g
  1. You should now be able to run curry --help to see a list of options.

  2. Using a browser, sign up for a free account at openexchangerates.org and obtain an API key.

  3. Copy the .env.sample to a new .env file

cp .env.sample .env
  1. Open your .env file and replace the dummy string with the API key obtained from Open Exchange Rates.
# .env 
OPEN_EXCHANGE_KEY = 235233_your_actual_key_goes_here_53531513346713476

Options

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 file

Troubleshooting

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

Package Sidebar

Install

npm i curry_conv

Weekly Downloads

2

Version

1.2.0

License

UNLICENSED

Unpacked Size

28 kB

Total Files

10

Last publish

Collaborators

  • ginnie77