Skip to content

Initial setup

Davide Zanella edited this page May 31, 2019 · 3 revisions

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 username
    • PGPASSWORD: postgres password
    • PGHOST: postgres hostname
    • PGPORT: postgres port
    • PGDATABASE: postgres name of the database
  • Figure-eight:
  • Yandex toloka:
  • Amazon Mechanical Turk (not supported yet):
  • 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.