Skip to content

abakus-ntnu/abacash-api

Repository files navigation

Abacash API Build Status Coverage Status

Node backend for Abacash

Setup

The Abacash backend is built using Node.js, and needs yarn installed on the system. After that is done, the server can be built using:

yarn
yarn build

Getting Started

You can use docker-compose to start up required backend services, such as PostgreSQL (the database). For that to work Docker and Docker Compose needs to be installed.

# Start required backend services with docker-compose:
$ docker-compose up -d

# Start the server (reloads on code changes):
$ yarn start:watch

# Or without reloading (production):
$ yarn build
$ yarn start

Tests

$ yarn test

To run tests with file watch:

$ yarn test:watch

To run a test a subset of the tests:

$ yarn test -g *pattern*

Here, pattern is a regex for the test descriptions. This also works on yarn test:watch.

Linting

ESLint and Prettier are used to maintain high code quality and a unified code style. It's recommended to install a Prettier plugin for your editor if there is one, to format the code when saving.

To run the linters, use:

$ yarn prettier
$ yarn lint

Load database with test data

$ yarn load-db

Will fill the abacash postgres database with fixtures from ./fixtures/. Connection string can be set by setting environment variable PG_URL. Contents in the fixtures are not (and should not be) used for automatic testing, which means the fixtures can be edited to test the client.