This app is a mock of one of a public API.
The mock API is built with:
- fastify: framework to build web APIs
Fastify plugins:
- fastify-jwt: JWT utils
- fastify-plugin: Makes import of plugins easier in Fastify
- fastify-swagger: documentation generator for API routes
Other modules:
- nodemon (dev only): hot-reloading on code changes.
- db-migrate: tool for database migration management
- db-migrate-mysql: mysql connector for db-migrate
- dotenv: loads variables in
process.env
- moment: tool for time and durations
- mysql: driver for MySQL database
- seedrandom: random number generator
- uuid: UUID generator
Clone the respository and cd
into it.
docker
Make sure you set the right environment variables:
DB_HOST: localhost
DB_USER: user
DB_PASSWORD: password
DB_NAME: mock_api_db
DB_POOL_CONNECTION_LIMIT: 10
DB_PORT: 1246
Install dependencies
> npm install
Generate an SSL certificate and key (cert.crt and cert.key) and place them into the ssl folder
Run the provided docker-compose-assessment.yml
.
Run the app:
> npm start
https://server:3000/gme?Action=CreateApp&Version=1&SecretId=somesecretid&Timestamp=1574095500&Signature=asignature&Nonce=1
See documentation for usage: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/usage/
Instructions for linux:
su root
npm install -g db-migrate
exit