/adidas-express-sub

Subscription service for adidas coding challenge

Primary LanguageTypeScript

adidas_express_sub app

Build Status

codecov

Run the app in terminal

  1. Start a Postgres database server on your machine or in the cloud.
  2. Set the following environment variables in your .env file
  3. Use the same enviroment variables for typeorm in your .prod.env file
POSTGRES_HOST=<address-where-database-running>
POSTGRES_PORT=<port-where-database-running>
POSTGRES_DB=<database-name>
POSTGRES_USER=<username-for-database>
POSTGRES_PASSWORD=<password-to-database>
  1. Install packages and start the application server.
$ npm install
$ npm start
  1. Build the application
$ npm build
  1. Generate and apply migrations
$ npm typeorm migration:generate --config .dev.env -n database-migrations
$ npm build
$ npm typeorm migration:run --config .dev.env

Run the app inside a Docker container

Build the docker container and get it up and running.

$ docker-compose build
$ docker-compose up

Run migrations inside a Docker container

With docker-compose running, in another terminal:

$ docker exec -it docker_name /bin/sh
$ npm typeorm migration:generate -n migration_name --config .prod.env
$ npm build
$ npm typeorm migration:run --config .prod.env

Make API calls against the server

  1. Go to http://localhost:8000/swagger to see Swagger documentation for API endpoints.
  2. Run the APIs by clicking the "Try it now" button on the Swagger page.

Run admin bro dashboard

Go to http://localhost:8000/admin

Run tests and check code coverage

$ npm test
$ npm coverage

Lint your code

$ npm lint
$ npm format