This project is my first RESTful API made using the MSC (Model-Service-Controller) architecture. The API is a sales management system based on dropshipping where you can create, visualize, delete and update products and sales.
In this project, I was able to:
- Learn and implement the MSC architecture;
- Divide my code into layers following the MSC architecture;
- Create unit tests for the model, service, and controller layers;
- Test using Mocha, Chai, and Sinon;
- Validate requests using Joi;
- Create a RESTful API;
- Connect the API to a MySQL database and use it;
JavaScript | Express | Node.JS | MySQL | Mocha JS | Chai JS | Sinon JS | Joi | Docker |
---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
- Clone and enter this repository
git clone [email protected]:ImVictorM/Store-Manager.git && cd Store-Manager
- Install the dependencies
npm install
- Get the containers running
docker-compose up -d
- Enter the server's container
docker exec -it store_manager bash
- Start the server
npm run start
---- or ----
npm run debug
Once the server is running, you must create and populate the database. To do this, open another terminal, enter the server's container (step 4) and type the following command:
npm run migration && npm run seed
Note: for the tests to work correctly, the server must be running.
Running all tests:
npm test