REST API for ODE features data
Adapted from Restbase
Make sure you have node 9+ installed
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_9.x | bash - && apt-get install -y nodejs
From the FeatureService
directory, install node dependencies:
npm install
Set up dev & test databases with docker:
docker pull mdillon/postgis
docker run --name devdb -p 127.0.0.1:5432:5432 -d mdillon/postgis
docker run --name testdb -e POSTGRES_USER=test -p 127.0.0.1:5433:5432 -d mdillon/postgis
Use seeding script to setup the dev database and download audio&image files (it is meant to run on a machine with the unzip command).
npm run seed
Start FeatureService:
npm start
The defaults without a config file should work. To customize FeatureService's behavior, copy the example config to its default location:
cp config.example.yaml config.yaml
You can also pass in the path to another file with the -c
commandline option
to server.js
.
To run all the tests from a clean slate:
npm test
To check the test coverage, use npm, then browse the report:
npm run-script coverage
The coverage report can now be found in <project>/coverage/lcov-report/index.html.
We use Knex to setup our database, you can migrate and seed for example as follows:
alias knex=node_modules/knex/bin/cli.js
knex migrate:latest
knex seed:run