Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/larissaperinoto/store-manager

Project Store Manager is a RESTful API for managing a store's system.
https://github.com/larissaperinoto/store-manager

chai express javascript mocha mysql nodejs sql swagger

Last synced: 17 days ago
JSON representation

Project Store Manager is a RESTful API for managing a store's system.

Awesome Lists containing this project

README

        

# Store manager

[Trybe](https://www.betrybe.com/) is a technology school focused on training Web Developers and the Store Manager project was proposed as an activity to improve studies on back-end development.

## Description

The developed application is a sales management system where it should be possible to create, update, read and delete products and sales.

## Technologies and Tools


mysql
nodejs
docker
express
mocha
Swagger


The elaboration of the RESTful API used the **Model-Service-Controller(MSC)** architecture, in addition to the following tools:

- [Node.JS](https://nodejs.org/en/)
- [Express](https://expressjs.com/pt-br/)
- [MySQL](https://www.mysql.com/)
- [Docker](https://www.docker.com/)

In the development of unit tests was used:

- [Mocha](https://mochajs.org/)
- [Chai](https://www.chaijs.com/)
- [Sinon](https://sinonjs.org/)

**Note**: The SQL scripts _migration.sql_ and _seed.sql_ for creating the *StoreManager* database were provided by [Trybe](https://www.betrybe.com/).

## ⚙️ How to use

To run the application, start by making a clone of this repository with the command below.

git clone [email protected]:larissaperinoto/store-manager.git

Navigate to the project root.

cd store-manager/

Running locally


Obs: To run the application this way you must have [Node](https://nodejs.org/en/) installed on your machine.

In the root of the project run the command below to install the dependencies.

npm install

To upload the server with nodemon use the command below in the terminal of the store_manager container.

npm run debug

Login to the database using your credentials.

mysql -u -p

Run the migration.sql and seed.sql scripts to create the Store Manager database.

Now we can run the tests using the command below.

npm run test:mocha

Running with Docker


Obs.: To run the application this way you must have [Docker](https://www.docker.com/) installed on your machine.

In the root of the project, upload the store_manager and store_manager_db containers using docker-compose.

docker-compose up -d

Open the store_manager container terminal.

docker exec -it store_manager bash

Once in the container terminal, run the command below to install the dependencies.

npm install

To start the server with nodemon use the command bellow in the terminal of the store_manager container.

npm run debug

To connect with database, open the store_manager_db container terminal.

docker exec -it store_manager_db bash

Login to the database using the credentials described in the docker-compose.yaml.

mysql -u root -p

Run the migration.sql and seed.sql scripts to create the Store Manager database.

We can run all tests using the command bellow in the terminal of the store_manager container.

npm run test:mocha

## Routes

You can check all the routes by accessing the /docs endpoint in your browser when running the application.

Routes preview

![Captura de tela de 2022-12-30 11-23-11](https://user-images.githubusercontent.com/98956659/210083904-17a7e8db-bf09-4f7f-9dc4-8f1cf06a05c2.png)


---

Developed by [Larissa Perinoto](www.linkedin.com/in/larissaperinoto), © 2022.