- In this Back-End project I created a Rest API with CRUD for managing a car shop, using OOP and SOLID principles and MSC architecture, with MongoDB database.
- User can Create, Read, Update and Delete cars and motorcycles registers in the Car Shop database, simulating transactions of sell and buy.
- The API have 100% of unit test coverage.
Development: TypeScript, Node.js, Express, Docker, Mongoose, Zod and MongoDB.
Test: Chai, Mocka and Sinon.
How to run the application with Docker (you need have already docker-compose installed in your machine)
Clone the repository
git clone git@github.com:Rafaqfg/Car_Shop---Rest-API-simulation.git
Enter in the project folder
cd Car_Shop---Rest-API-simulation-TypeScript
Install the dependencies
npm install
Up the Docker containers using the compose file (door 27017 must be avaible)
docker-compose up -d
Attach in the container terminal
docker exec -it car_shop bash
Start the application (door 3001 must be avaible)
npm run:dev
Run all unit tests
npm run test:dev
Run coverage test
npm run test:coverage
description | finished |
---|---|
Create the generic IModel interface | ✔️ |
Create the IVehicle interface | ✔️ |
Create the ICar interface from the IVehicle interface | ✔️ |
Create a route to the /cars endpoint where it is possible to register a new car | ✔️ |
Create a route to the /cars endpoint where you can list all registered cars | ✔️ |
Create a route to the /cars/id endpoint where it is possible to list a single car through its id | ✔️ |
Create a route to the /cars/id endpoint, where it is possible to update the registration of a car through its id | ✔️ |
Create a route to the /cars/id endpoint to delete a car's records | ✔️ |
Create the IMotorcicle interface from the IVehicle interface | ✔️ |
Create a route to the /motorcycles endpoint where it is possible to register a new motorcycle | ✔️ |
Create a route to the /motorcycles endpoint where you can list all registered motorcycles | ✔️ |
Create a route to the /motorcycles/id endpoint where it is possible to list a single motorcycle through its id | ✔️ |
Create a route to the /motorcycles/id endpoint where it is possible to update the registration of a motorcycle through its id | ✔️ |
Create a route to the /motorcycles/id endpoint to delete the records of a motorcycle | ✔️ |
Write tests to cover 100% of the Controller layer | ✔️ |
Write tests to cover 100% of the Service layer | ✔️ |
Write tests to cover 100% of the Model layer | ✔️ |