This is an API implementation for the Refuge IT System landscape.
For API Reference and Live Endpoint, check out: Refuge Live API
Live API is deployed on Heroku.
Swagger API is autogenerated with express-oas-generator.
Base API URL: https://refuge-api.herokuapp.com
Direct Link to Swagger Documentation: https://refuge-api.herokuapp.com/api-docs
This API uses passportjs for Authentication. Current implementation works with JWT Tokens. Will be extended later to also include Google Login.
To run the tests, type npm test.
To start the server, type npm start. Beware though, currently, start script is setup to migrate to latest changes and restore all default DB values on start. You might want to change those in production.
You need to have a .env file for environemental settings. Currently, there are three keys you need to be set:
HOST
PORT
SECRET
For retrieving settings from .env, dotenv is used.
Testing libary used is: Mochajs with Chai.
This project uses sequelize as an ORM with SQlite as a light-weight DB. Migrations as well as seeds can be run for three different environements
- test
- development
- production
Use --env flag to determine for which environement to run (for migrations as well as seeds). Default is "development" (i.e. no flag).
You can find more details here: http://docs.sequelizejs.com/manual/migrations.html
To run sequlize migrations for initial DB Setup (values in [] are optional, values in <> are possible values), type:
npx sequelize-cli db:migrate [--env <test|development|production>]
To run sequelize seed operation for initial DB Setup (values in [] are optional, values in <> are possible values), type:
npx sequelize-cli db:seed:all [--env <test|development|production>]
Test DB Setup Example:
npx sequelize-cli db:migrate
npx sequelize-cli db:seed:all --env test
Migrates and seeds test database.
//TODO
- Testing Setup Sequlize + MochaJS
- Write Tests for Models, Routes, Services, Controllers etc.