- Node.js Architecture was taken from Bulletproof Node.js
- Does not include Dependency Injection, Decorators, Jobs
celebrate
- Middleware that validates request inputs (i.e. req.body...etc)
morgan
- Logs HTTP requests (useful for debugging)
winston
- Logger with support for multiple transports (i.e. multiple ways to store logs)
event-dispatch
- Allows for registering & dispatching events (useful for separation of concerns)
nodemon
- Automatically restarts API when there are changes to any
.ts
files
- Automatically restarts API when there are changes to any
dotenv
- Reads environmental variables from env file and makes it accessible via
process.env
- Reads environmental variables from env file and makes it accessible via
pg
- Connect to Postgres
To futher understand the architecture, refer to the Bulletproof node.js project architecture blog
Uses node
version 16.13.1
Docker Desktop which includes Docker Engine, Docker CLI client, Docker Compose is required
- Rename
.env-sample
to.env
& change variables as needed (exceptDB_HOST
&DB_PORT
) - Start up Docker Desktop
- Run
npm i
to install packages - Run
docker-compose up
in the terminal to start up the services in Docker containers
- Make POST request to
http://localhost:5000/api/auth/signup
withbody
as{"password": "hi"}
- Should get status
200
with response asSign up Successfully
- Should get status
- To view the DB via
PgAdmin
, usehost
aslocalhost
&port
as5433
(yes5433
not5532
as we exposed5433
indocker-compose.yml
)- Should see database with name
db_name
& tableuser
with 1 entry
- Should see database with name