Sequelize: Promise-based Node.js ORM for PostgreSQL, MySQL, MariaDB, SQLite, and Microsoft SQL Server.
Development Tools:
eslint: Pluggable linting utility for JavaScript and TypeScript code.
prettier: Opinionated code formatter that automatically formats code according to predefined rules.
TypeScript: Typed superset of JavaScript that compiles to plain JavaScript.
NestJS CLI: Command-line interface tool for NestJS applications.
Containerization:
Docker: Containerization platform used to manage MySQL and PostgreSQL databases, simplifying deployment and ensuring consistency across environments.
Documentation
Endpoint
Categories
Method
Endpoint
Description
[GET]
/categories
Find all categories
[GET]
/categories/:id
Find one category by id
[POST]
/categories
Create a category
[PATCH]
/categories/:id
Update category
[DELETE]
/categories/:id
Remove a category (it should set null to productcategoryId on delete)
Products
Method
Endpoint
Description
[GET]
/products
Find all products
[GET]
/products/:id
Find one product by id
[POST]
/products
Create a product
[PATCH]
/products/:id
Update a product
[DELETE]
/products/:id
Remove a product (it should remove the stock)
It should create a stock to respective product when it was created.
Stock-Product has One-One Association.
Stock
Method
Endpoint
Description
[GET]
/products/:id/stock
Find the stock by associated productid.
[PATCH]
/products/:id/stock
Update the stock by associated productid.
[DELETE]
/products/:id/stock
It should return status [501] - Not Implemented. (can't delete a stock)
Backup
The application automatically backs up the MySQL database to PostgreSQL every 10 seconds. Ensure you have configured the necessary environment variables for the PostgreSQL connection in your .env file.
About
Simple shop backend with RESTful API and database redundancy.