Create a service to collect different sizes for the shoes and calculate their TrueToSize. TrueToSize for a shoe is an average of all the sizes available in that shoe model.
This app is developed with NODE.JS and uses Postgres as the database. Also, I have containized the app to run on any machine with docker-compose.
NOTE: Your machine must have Node:10, docker and docker-compose installed.
- Create .env and .evn.test files in the root app directory with the following variables
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- POSTGRES_DB=db
- PORT=3000 (3001 for dev)
- DB_PORT=5432 (8002 for dev)
-
- add the following to .env.test file
-
- APP_URL=http://localhost:3001
-
- Download the project
- Cd into the app/test directory
- Run
docker-compose upto setup testing database - Run
npm installto install dependencies - Run the app in dev mode with
npm run dev - For unit/integration test, run
npm testfrom app folder - Once the db and app are running, run
npm run test-e2efor E2E tests - App should be running at
http://127.0.0.1:3001/
-
- Download the project
- Cd into the app directory
- Run
docker-compose build appto build the docker image - Run
docker-compose upto setup testing database - App should be running at
http://127.0.0.1:8080/
You can also some the app in a container
/getto show all the inserted shoes/shoe/insert/:shoeNameto insert a new shoe model shoeName/:shoeName/addsize/5to add size 5 for shoe model shoeName/:shoeName/truetosizeto get TrueToSize for mode shoeName
- Logs from the containers are bind to in app/var/log