If you will running the app only in production mode:
npm install --production
Otherwise, run without the --production
flag:
npm install
The app expects the following to be available on process.env
:
OPEN_EXCHANGE_API_KEY="YOUR_KEY_HERE"
OPEN_EXCHANGE_API_HOST="https://openexchangerates.org"
dotenv
is set up, so if you prefer, add a file named .env
in this directory with the above (substituting your actual api key).
In order to avoid a security warning (which is not applicable in non-production environments¹), the cert needs to be marked "trusted".
On Mac:
- Open Keychain Access
- Select
Certificates
under Category in the side panel - Import the root cert:
- File → Import Items…
- Select
generic-localhost_rootCA.pem
- Change the dropdown for When using this certificate:
Always Trust
. If you forget to change the dropdown, simply:- Double-click on the already-imported certificate
- Expand Trust
- Change the top dropdown to
Always Trust
(OSX / KeyChain Access prompt you to enter your Mac password)
HTTP/2 requires SSL, and thus an SSL certificate. Included with this app are the necessary files:
File Name | Description
./generic-localhost_rootCA.pem
| A self-signed root certificate¹
./src/server/server.crt
| A domain certificate for localhost
./src/server/server.key
| The private key for the domain certificate
¹ Do NOT use a self-signed certificate in actual production
Prod mode will compile the app to run most efficiently. This compilation takes longer, but need be done only once (until the source is changed).
To compile the app for production:
npm run prod
If you choose to use the optional http-server
dependency (devs, you may already have installed globally), you can use the provided command to start a server to host the app:
npm run start
npm run start
command is configured to automatically proxy API requests to the real API. Use sparingly as the free subscription is limited to a relatively small maximum number of requests per month.
Dev mode quickly compiles the app without optimisations and enables code updates to be quickly available.
npm run dev
The dev server stubs API requests to avoid spamming the real API. It returns static (but realistic) data.
npm run test
Or to automatically re-run on change:
npm run test:watch