- Docker
- Docker-Compose
- Make -
sudo apt-get install build-essential
- Create necessary docker networks:
docker network create nginx_proxy
- Run nginx proxy
# note: --restart=always restarts the container automatically after reboots
docker run -d -p 80:80 --name=nginx-reverse-proxy --network=nginx_proxy --restart=always -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
- Setup
VIRTUAL_HOST
entries in you hosts file
# on Linux - /etc/hosts
# on Windows - C:\Windows\System32\drivers\etc
host$ > sudo nano /etc/hosts
# - Add the following line to your `hosts` files
127.0.0.1 api.stonk.local
- Create a copy of
secret.yml.example
and rename it tosecret.yml
- Run
make build
- The image is built and stored locally
- Run
make run
- Starts up all the services defined in the
docker-compose
files and keeps the process open in the current terminal - Running
make run-d
will start a detached process - Monitoring the logs can help debug startup issues or programming errors, either by not starting a detached process, or by tailing the STDOUT/STDERR with
make run logs
- Starts up all the services defined in the
host$ > make run
# or
host$ > make run-d
- Refer to the content of the
Makefile
for other useful commands
After configuring your VIRTUAL_HOST, and running make build && make run
in the root folder of the project.
Backend app will be accessible on http://api.stonk.local or http://localhost:8080
Please checkout api/example.http
for all the endpoints required in this exercise.
To use the api/example.http
file on VSCode, please install the Rest Client (humao.rest-client) extension.
I opted to use UUID
instead of integer
as a id
reference for [Users, Trades, and Stocks]
- Run
make connect service=<service>
- The
service
must be the name defined in the docker-compose files, e.g.api
ordatabase
.
- The
- To test the
api
- Connect to the running service
- Run the
test
yarn command in theapi
container
# from project-root directory host $ make connect service=api /app # yarn run migration:run /app # yarn run test
- Authentication of
Users
- Authorization of
Users
- Full CRUD for all Major Entities [
Trades
,Stock
,Users
]- currently:
Trades
[Create, Read]Users
[Create, Read]Stocks
[Create, Read]
- currently:
- Add Linting Fix with ESLint
- Configure testing through
make test
using properdocker-compose.test.yml
- Reformating strings payloads with trailing spaces in Request.body
- Implement a
BaseController
- To abstract some of the bloat in the current controllers - Unit test for the
StocksService -> getStockStats(...)
- On Delete User -> Cascade-Delete User Trades