Public | Automated Build

Last pushed: 9 months ago
Short Description
Simple Express RESTful API for People data designed for use in CI/orchestration PoCs
Full Description

Node People API


Simple Express RESTful API for People data.

Using as part of testing various build/containerisation PoCs.

Requires

Run

npm install

# Set env for MySql database
# docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=people -p 3306:3306 -d mysql:latest
export DB_USERNAME='root'
export DB_PASSWORD='root'
export DB_SERVER='127.0.0.1'
export DB_DATABASE='people'

# Setup DB
node_modules/.bin/knex migrate:latest --env development

# available http://localhost:3001/people
npm start

Run in container

# Spin up MySql and node-people-api containers
docker-compose up

Test

npm test

API Documentation

The API is documented using API Blueprint at PeopleApi.apib and a friendly static HTML version is generated using aglio which is available on at URL /documentation.html.

The documentation is be updated for changes by:

npm install -g aglio
aglio -i PeopleApi.apib --theme-template triple -o app/documentation/documentation.html

The PeopleApi.apib file can be used by various tools to aid with testing or generating clients.

Notes

  • used npm shrinkwrap to fix dependency versions
  • added wait-for-mysql.sh script to poll mysql container using knex migrate:currentVersion before running migration scripts, avoiding the need to call migration scripts outside container
Docker Pull Command
Owner
stevenalexander
Source Repository

Comments (0)