This is a CRUD API for a store manager. It is built using NodeJS, Express and MySQL. I have used the MSC(Models, Services, Controllers) architecture for this project and Docker for containerization. Development was done using TDD(Test Driven Development) and the tests were written using Mocha, chai and sinon.
You can Create, Read, Update and Delete products and sales records.
- NodeJS - JavaScript runtime
- Express - Web framework for NodeJS
- MySQL - Database
- Docker - Containerization
- Docker Compose - Container orchestration
- Mocha - Testing framework
- Chai - Assertion library
- Sinon - Test spies, stubs and mocks
- Swagger - API documentation
The swagger API documentation can be found here.
Documentation file .yaml can be found here.
Insomnia workspace can be found here.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You will need to have the following installed on your machine:
To get the development environment running, you will need to clone the repository and run the following commands:
docker-compose up -d
This will start the MySQL container and the NodeJS container. The MySQL container will be running on port 3306 and the NodeJS container will be running on port 3000.
After the containers are running, you will need to connect to the bash of the NodeJS container:
docker exec -it store_manager bash
finally, you will need to install the dependencies:
npm install
To run the tests, you will need to connect to the bash of the NodeJS container:
docker exec -it store_manager bash
and then run the following command:
npm test
To run the API, you will need to connect to the bash of the NodeJS container:
docker exec -it store_manager bash
and then run the following command:
npm start
or
npm run debug