A simple e-commerce application built with Java and Spring Boot.
- Java
- Spring Boot
- Maven
- Clone the repository:
git clone https://github.com/Falasefemi2/ecommerce.git
- Navigate to the project directory:
cd ecommerce
- Build the project:
./mvnw clean install
Run the application using the following command:
./mvnw spring-boot:run
The application will be available at http://localhost:3080
.
The following endpoints are available:
GET /api/v1/products
: Get a list of all products.GET /api/v1/products/{productId}
: Get a specific product by its ID.POST /api/v1/products
: Create a new product.PUT /api/v1/products/{id}
: Update an existing product.DELETE /api/v1/products/{id}
: Delete a product by its ID.GET /api/v1/products/brand-and-name?brand={brand}&name={name}
: Find products by brand and name.GET /api/v1/products/category-and-brand?category={category}&brand={brand}
: Find products by category and brand.GET /api/v1/products/name?name={name}
: Find products by a name containing the given string.GET /api/v1/products/brand?brand={brand}
: Find products by brand.GET /api/v1/products/category/{category}
: Find products by category name.GET /api/v1/products/count?brand={brand}&name={name}
: Count products by brand and name.
GET /api/v1/categories
: Get a list of all categories.POST /api/v1/categories/add
: Create a new category.GET /api/v1/categories/{id}
: Get a specific category by its ID.GET /api/v1/categories/by-name
: Find products by category and brand.DELETE /api/v1/categories/{id}
: Delete a category by its ID.PUT /api/v1/categories/{id}
: Update an existing category.
POST /api/v1/images
: Upload one or more images for a product.GET /api/v1/images/download/{imageId}
: Download an image by its ID.PUT /api/v1/images/{imageId}/update
: Update an existing image.DELETE /api/v1/images/{imageId}
: Delete an image by its ID.
GET /api/v1/carts/{cartId}
: Get a cart by its ID.DELETE /api/v1/carts/{cartId}/clear
: Clear a cart by its ID.GET /api/v1/carts/{cartId}/total
: Get the total amount of a cart by its ID.
POST /api/v1/cartsItem/{cartId}/items
: Add an item to a cart.POST /api/v1/cartsItem/items
: Add an item to a new cart.PUT /api/v1/cartsItem/{cartId}/items/{productId}
: Update the quantity of an item in a cart.DELETE /api/v1/cartsItem/{cartId}/items/{productId}
: Remove an item from a cart.
-POST /api/v1/orders
: Create a new order.
-GET /api/v1/orders/{orderId}
: Get an order by its ID.
-GET /api/v1/orders/users/{userId}/orders
: Get all orders for a user.
-GET /api/v1/users/{userId}
: Get a user by their ID.
-POST /api/v1/users
: Create a new user.
-PUT /api/v1/users/{userId}
: Update an existing user.
-DELETE /api/v1/users/{userId}
: Delete a user by their ID.
The following tests are available:
CategoryControllerTest.java
ImageControllerTest.java
ProductControllerTest.java
UserControllerTest.java
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
To run the tests, use the following command:
./mvnw test