Skip to content

ImVictorM/Store-Manager

Repository files navigation

Store Manager 🛍️

Project Context 💡

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.

Acquired Knowledge 📖

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;

Main Technologies used 🧰

JavaScript Express Node.JS MySQL Mocha JS Chai JS Sinon JS Joi Docker
javascript express nodejs mysql mocha-js chai-js sinon-js joi docker

Running the application ⚙️

  1. Clone and enter this repository
git clone git@github.com:ImVictorM/Store-Manager.git && cd Store-Manager
  1. Install the dependencies
npm install
  1. Get the containers running
docker-compose up -d
  1. Enter the server's container
docker exec -it store_manager bash
  1. 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

Testing 🛠️

Note: for the tests to work correctly, the server must be running.

Running all tests:

npm test