This project was used to build an API available through Express to manage an online service store, featuring item classes and a cart creation and management. It was the pattern Adapter to decouple the use of ORM SQL libraries, here being available the library Sequelize.
The design patterns FactoryMethod and Facade were also used. The concept of Dependency Injection was applied. In addition, it was developed with Automated Tests using the Jest library for the creation, simulation and execution of tests.
The project also has a log service using Winston and Elasticsearch, being possible to view the logs through Kibana. Both are available for Api through Docker.
The project uses the following technologies: NodeJs Ts-Node Typescript Express Cors Winston Jest Ts-Jest Sequelize MySQL Eslint Express-Rate-Limit, http-status-codes, Husky Elasticsearch Kibana Docker
- Make Elasticsearch, Kibana and MySQL services available
$ docker-compose up -d
- You might need to free more space on docker to run Elastic, in this case ( for WSL ) use the command below and restart the container:
$ wsl -d docker-desktop
$ sysctl -w vm.max_map_count=262144
-
Configure MySQL with a database, user and password. Add this information in config/dev.env . Create the tables for each class. To do that you may find useful: MySQL Tables
-
To install all project dependencies
$ npm install
- To run the project in local environment
$ npm run dev
A API se encontrará disponível na porta 8080
- Main scripts used to create tables : MySQL Tables