Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.
/ api Public archive

The Mixnjuice REST API

License

mixnjuice/api

Repository files navigation

Mixnjuice API

Build status: CircleCI

Test coverage: codecov

This repository contains the express-based API that powers the Mixnjuice frontend.

Libraries

Usage

Before use, from psql as the postgres user:

create database flavors;
create user flavors with encrypted password 'changeme';
grant all privileges on database flavors to flavors;
\c flavors
create extension if not exists "pgcrypto";

The pgcrypto extension is used to generate UUIDs.

Now, in a shell:

npm install
npm run build
cp .env.default .env

Configuration resides in .env. Edit this file and supply your database information. Finally:

npm run migrate
npm start

You can use npm run migrate 0 to revert all database migrations, or npm run migrate X to migrate to version X.

Authentication

Some requests require a bearer token by default. If you start the server with the API_TOKEN_VALIDATE environment variable set to false the token check will be bypassed. For convience you can run npm run start-mock to start the API up with anonymous auth enabled.

Docker

Simply run docker-compose up from the source root. Use the --no-start option to create the containers without starting them in interactive mode.

You can manually migrate the database using

docker-compose run --rm api npm run migrate

Miscellaneous

To send email using Amazon SES, install the AWS CLI. Then run

aws configure

Alternatively, configure the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables in .env.

You can clean out tokens that have expired more than three hours ago using

node lib/cleanTokens.js

Development

Visual Studio Code is the recommended IDE for this project.

The following VS Code extensions will improve your development experience:

  • dbaeumer.vscode-eslint
  • esbenp.prettier-vscode

The recommended settings for the extensions and VS Code are saved in .vscode/settings.json and will automatically be used.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages