Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
/ api Public archive

The OpenTrials API service + database schema definition.

Notifications You must be signed in to change notification settings

opentrials/api

Repository files navigation

api

Gitter Travis Build Status Coveralls Dependency Status Issues Docs

The OpenTrials API service.

Developer notes

Requirements

  • Node 6.9
  • PostgreSQL 9.4
  • ElasticSearch 2.3.5

Installing

  1. Copy the .env.example file to .env and alter its contents as needed. At minimum, you should set the DATABASE_URL and ELASTICSEARCH_URL. The TEST_DATABASE_URL is needed to run the tests. You could leave the ELASTICSEARCH_AWS_* as is if you're not using ElasticSearch on AWS;
  2. Run npm install;
  3. Run npm run migrate;
  4. (Optional) If you want, you can add some seed data using npm run seed;
  5. Run npm run reindex;

After the install and migrations ran successfully, you can run npm run dev to run the project. If you haven't changed the default PORT, it should be available at http://localhost:5000

Reindexing

Currently, there's no way to automatically reindex the data. Every time you change the database, you'd need to run npm run reindex to keep ElasticSearch in sync.

Testing

You can run the test suite and linting with npm test.

Interacting with the API

You can find and interact here with the available endpoints.