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.
![workflow](https://private-user-images.githubusercontent.com/108496649/341726248-0dbfeb7a-479b-4dc8-a56d-28600ee3ae28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MTc5MzksIm5iZiI6MTcyNDcxNzYzOSwicGF0aCI6Ii8xMDg0OTY2NDkvMzQxNzI2MjQ4LTBkYmZlYjdhLTQ3OWItNGRjOC1hNTZkLTI4NjAwZWUzYWUyOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyN1QwMDEzNTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04N2U3ODUzY2ZmNzVjMGZmOWUyMmZlOTg4MzE0MDFlZWM2MGJjYjUzZWFhZDNkZDg4ZjYyMzk2NDQwNzRmMWIxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.tS4sz8ESJk6eCZmIu7xvRtyfJm6E6f2LC6O-wvXmS7M)
- 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 !