Initial setup - TrentoCrowdAI/crowdhub-api GitHub Wiki
Initial setup
Node dependencies
Install the required node.js dependencies by running npm install
in the root folder of the project.
Environment variables
Add the following custom environments variables in order to use servant-api:
- Postgres DB:
PGUSER
: postgres usernamePGPASSWORD
: postgres passwordPGHOST
: postgres hostnamePGPORT
: postgres portPGDATABASE
: postgres name of the database
- Figure-eight:
F8_API_KEY
: the F8 Api keyF8_BASE_ENDPOINT
: Base endpoint of F8 (https://api.figure-eight.com/v1/)
- Yandex toloka:
TOLOKA_ACCESS_TOKEN
: Toloka access tokenTOLOKA_BASE_ENDPOINT
: Toloka base endpoint (https://toloka.yandex.ru/api/v1/)TOLOKA_SANDBOX_ENDPOINT
: Toloka base endpoint of the sandbox mode (https://sandbox.toloka.yandex.ru/api/v1/)
- Amazon Mechanical Turk (not supported yet):
AWS_ACCESS_KEY_ID
: mTurk access key idAWS_SECRET_KEY
: mTurk secret keyAWS_REGION
: mTurk region (us-east-1)AWS_ENDPOINT
: mTurk base endpoint (https://mturk-requester-sandbox.us-east-1.amazonaws.com)
- Google OAuth:
GOOGLE_CLIENT_ID
: Google client ID used for authenticating the user
DB init
Inside the src/db
folder there is a init.sql
file which is needed to recreate the postgres DB.
How to run tests
Simply run npm test
inside the folder or specify a regex as a parameter to execute only specific .spec.js files.
After the whole tests execution jest is set to drop all the active connections to the postgres DB to avoid jest keeping active some background processes and fail on Travis.
Project environments
Travis
Travis is set to execute tests on all branches. In the settings all the env variables are configured.
Heroku
Heroku hosts the master
and the develop
branches on two different endpoints.