The backend solution is an API for managing employees with just 3 controllers, using MongoDB for persistence, request validation with express-validator, and try-catch blocks to make the application understandable and easy to debug.
I personally used a Mongo Docker image and Render for deployment!
db-image
: branch is responsible for creating the mongodb container which serves as the database.feature
: branch will contain all project requirements divided into sub branches and labeled withenhancements
.release
: branch is merged into the main branch when the work is tested and completed.
I created this workflow with Figjam, a Figma product that is excellent for creating diagrams workflows and even project management ^^More documentation is included in the issues tab.
- To build the application (generate the javascript dist) :
npm run build
- To run the application in the development mode :
npm run dev
- To run the mongo docker container (MongoDB database in a container created with few commands and isolated form the OS):
// navigate to docker compose
> cd ./db
// run docker compose file in detached mode
> sudo docker compose up -d
// open the mongo shell to interacte with the database
> docker exec -it personal-mongo-database mongosh
YOURE INSIDE THE CONTAINER NOW YOU CAN LIST DATABASES, USE ONE, DO ANY CRUD OPERATIONS...
# list all databases
> show dbs
# use a specific database
> use db_name
# see all the collections of the database selected
> show collections
# list all documents in a collection
> db.db_name.find()
the test is performed using
Thunder Client
I recorded the tests before adding the reqeust validation branch
-
POST /employees: Add a new employee: demo for adding new employee
-
PUT /employees/:id: Update an existing employee's details: demo for updating an employee
-
DELETE /employees/:id: Delete an employee by ID: demo for deleting an employee
I recommand to see the issues tag in the process of understandimg the solution (ordered) implementations:
Also reading the mentionned pull request in every issue is a good win !