https://github.com/realchaula/ordermicroservice
SpringBoot REST API to Handle Order Details For NextTrend Web Application (MySQL)
https://github.com/realchaula/ordermicroservice
api mysql rest-api restful-api spring-boot springboot swagger swagger-ui swagger2
Last synced: about 2 months ago
JSON representation
SpringBoot REST API to Handle Order Details For NextTrend Web Application (MySQL)
- Host: GitHub
- URL: https://github.com/realchaula/ordermicroservice
- Owner: RealChAuLa
- License: mit
- Created: 2024-08-25T13:34:23.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T21:28:40.000Z (over 1 year ago)
- Last Synced: 2025-02-05T20:32:57.755Z (over 1 year ago)
- Topics: api, mysql, rest-api, restful-api, spring-boot, springboot, swagger, swagger-ui, swagger2
- Language: Java
- Homepage: https://github.com/RealChAuLa/NexTrendClothing
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Order Microservice API
This is a RESTful API service for managing orders in an e-commerce system. The service is built using Spring Boot and MongoDB.
## API Endpoints
### Redirect to Swagger UI
- **URL:** `/`
- **Method:** GET
- **Description:** Redirects to the Swagger UI documentation page
### Get All Orders
- **URL:** `/orders`
- **Method:** GET
- **Description:** Retrieves all orders from the database
- **Response:** List of OrderServiceData objects
### Create New Order
- **URL:** `/order`
- **Method:** POST
- **Description:** Creates a new order
- **Request Body:** OrderServiceData object
- **Response:** Created OrderServiceData object
### Get Orders by Username
- **URL:** `/orders/username/{username}`
- **Method:** GET
- **Description:** Retrieves all orders for a specific username using MongoDB pipeline
- **Parameters:**
- `username` (path parameter)
- **Response:** List of OrderServiceData objects
### Get Top 4 Best-Selling Products
- **URL:** `/orders/bestsales`
- **Method:** GET
- **Description:** Retrieves the top 4 most sold products based on quantity
- **Response:** List of TopSalesData objects
## Cross-Origin Resource Sharing (CORS)
This API supports CORS with all origins (`*`).
## Documentation
The API is documented using Swagger UI. You can access the documentation by navigating to the root URL (`/`), which will redirect you to `/swagger-ui.html`.
## Data Models
### OrderServiceData
Represents an order in the system. (Detailed structure to be implemented)
### TopSalesData
Represents the sales statistics for products. (Detailed structure to be implemented)
## Dependencies
- Spring Boot
- Spring Web
- MongoDB
- Springfox Swagger UI
## Setup and Configuration
1. Clone the repository:
```sh
git clone https://github.com/RealChAuLa/OrderMicroService.git
2. Navigate to the project directory:
```sh
cd OrderMicroService
3. Build the project using Maven:
```sh
mvn clean install
4. Run the application:
```sh
mvn spring-boot:run
## License
This project is licensed under the MIT License.