/test-assesment

testing

Primary LanguageJavaScript

Content

This app is a mock of one of a public API.

Getting started

The stack

The mock API is built with:

  • fastify: framework to build web APIs alt text

Fastify plugins:

Other modules:

To run it locally

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

Sample call

https://server:3000/gme?Action=CreateApp&Version=1&SecretId=somesecretid&Timestamp=1574095500&Signature=asignature&Nonce=1

Database migrations

See documentation for usage: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/usage/

To use db-migrate commands outside the container, make sure you have db-migrate installed globally.

Instructions for linux:

su root
npm install -g db-migrate
exit