This project implements a RESTful API for managing a product catalog using Node.js, Express.js, MySQL, and TypeScript.
- Create new brands, categories, and items.
- Retrieve brands, categories, and items.
- Update existing brands, categories, and items.
- Delete brands, categories, and items.
- Update stock quantities for items.
- Centralized error handling and validation.
- Node.js
- Express.js
- TypeScript
- MySQL with TypeORM
- Joi for validation
- Swagger for API documentation
- Clone the repository:
git clone https://github.com/Yasinj05/product-catalog.git
- Navigate to the project directory:
cd product-catalog
- Install dependencies:
npm install
- Create a .env file in the root directory and add your MySQL connection details:
PORT=your-port
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USERNAME=your-username
DATABASE_PASSWORD=your-password
DATABASE_NAME=your-db-name
- Start the server:
npm run start
The API is documented using Swagger. Once the server is running, you can access the documentation at http://localhost:3000/api-docs
.
- URL: POST
/api/brands
- URL: PUT
/api/brands/:id
- URL: GET
/api/brands
- URL: GET
/api/brands/:id
- URL: DELETE
/api/brands/:id
- URL: POST
/api/categories
- URL: PUT
/api/categories/:id
- URL: GET
/api/categories
- URL: GET
/api/categories/:id
- URL: DELETE
/api/categories/:id
- URL: POST
/api/items
- URL: PUT
/api/items/:id
- URL: GET
/api/items
- URL: GET
/api/items/:id
- URL: DELETE
/api/items/:id
- URL: PATCH
/api/items/:id/stock
Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.
This project is licensed under the MIT License. See the LICENSE file for details.