This project implements a set of API endpoints for handling CRUD (Create, Read, Update, Delete) operations of orders. The API processes order details including user ID, product IDs, quantities, and payment information. It handles various HTTP methods such as GET, POST, PUT, PATCH, and DELETE requests for managing orders. The endpoint is designed to validate incoming data, handle exceptions gracefully, and return appropriate responses.
- Implements CRUD operations for orders
- Validates incoming data
- Handles exceptions
- Supports various HTTP methods (GET, POST, PUT, PATCH, DELETE)
-
Clone the repository:
git clone https://github.com/AIM3r4j/order-management.git
-
Navigate to the project directory:
cd order-management
-
Install dependencies:
npm ci
-
Set up environment variables:
-
Create a .env file based on the provided .env.example file.
-
Update the variables with appropriate values.
-
-
Run application:
npm run start:dev
-
Build the Docker image:
docker build -t <image_name> .
-
Run the Docker container:
docker run -p <host_port>:<container_port> -d <image_name>
-
Replace <host_port> with the port on your host machine where you want to access the application, and <container_port> with the port specified in the .env file or the default port if not specified. <image_name> is the name you gave to your Docker image in step 1.
-
Locate the "Order Management.postman_collection.json" file inside the base folder
-
Import the file into Postman
-
Use the postman collection as the documentation for the app
-
Update the baseURL variable's port if needed
- GET /orders: Retrieve all orders
- GET /orders/:id: Retrieve a specific order by ID
- POST /orders: Create a new order
- PUT /orders/:id: Update an existing order
- PATCH /orders/:id: Partially update an existing order
- DELETE /orders/:id: Delete an existing order