The API for the forge-app. An API written with Hapi which hooks into a number of Seneca microsservices. The API can also be configured to run as a monolith by loading the microservices as plugins.
The api requires:
- Node.js (version 4+)
- MongoDB
Follow instructions here.
Import MongoDB public key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Add the repo to sources.list:
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Update and install:
sudo apt-get update
sudo apt-get install -y mongodb-org
Using Homebrew:
brew update
brew install mongodb
Clone:
git clone https://github.com/darragh-hayes/forge-app.git
Install:
npm install
The app config exists in config.js.
Most of the config options come from environment variables. Sane defaults are in place for local development.
The relevant environment variables are:
API_HOST
- API hostname/ipDefault:
0.0.0.0
API_PORT
- API port numberDefault:
4000
forge_DEBUG
- Enables debug logging on the server- true | false
Default:
false
CALENDAR_HOST
- Hostname/ip of calendar microserviceDefault:
127.0.0.1
EXERCISES_HOST
- Hostname/ip of exercises microserviceDefault:
127.0.0.1
USERS_HOST
- Hostname/ip of users microserviceDefault:
127.0.0.1
MONGO_NAME
- Name of DatabaseDefault:
forge
MONGO_HOST
- Hostname/ip of MongoDB serverDefault:
127.0.0.1
MONGO_PORT
- MongoDB server portDefault:
27017
MONGO_USERNAME
- Mongo username if access control is configured (recommended for production)Default
:null
MONGO_PASSWORD
Default
:null
JWT_KEY
- Secret key for encrypting and signing JSON web tokens.Default
:password
PRODUCTION
- Determines whether the app runs as a monolith or not.TRUE:
The API runs by itself and will attempt to connect to external microservices. The other services must be installed and runFALSE:
The API loads the microservices as plugins and runs in a single process.Default:
FALSE