This assessement is taken from: https://gist.github.com/d3hiring/4d1415d445033d316c36a56f0953f4ef
You can run the test suite by hitting this IP: 128.199.147.222:8400
.
Postman collection is exported to this postman file.
Get up and running quickly with docker-compose
docker-compose -f stack.yml up
or run the whole thing manually by
- Getting mysql in your docker daemon running via
docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_PASSWORD=password -e MYSQL_USER=mysql -e MYSQL_DATABASE=d3hiring -p 3306:3306 -d mysql:latest
mv
the.env.sample
to.env
so you can modify the environment variables loaded- run the api using
yarn dev
which will load typscript in development mode.
You can build the codebase and run it separately via
yarn build
docker build -t d3hiring .
docker run -e NODE_ENV=production -e MYSQL_HOST=mysql -p 8400:8400 d3hiring
- make sure you modify
MYSQL_HOST
to point to the correctHOST
, else the service won't know where the database is.
- Before running requests, make sure you go to
/api/authorize
and get your token. - Add the
token
into your Authorization header asAuthorization: Bearer ${token}
- Run all subsequent requests using the above
Tests are located in the test
directory
yarn test
- @mention parsing uses regex and does not guarantee email validity
- The codebase uses
synchronize: true
in TypeORM for convenience. Of course, this should not be done in production. - When a student OR teacher does not exist in a request, it is created. If it exists, it uses the existing record.
- Sample auth via JWT is implemented in
src/authorizer/token.ts
- OAS3 is implemented up front and have rudimentary validations baked in
- Starting docker-compose will have the server throw errors because MySQL is not yet available. I did not include a wait time for this.
- Request logging is enabled for verbosity
- No SSL cert is implemented on the Digital Ocean Droplet, however it is easy to apply via AWS CF, CF, or DO.
- CD uses scp and ssh. no fancy deployments here.