This is a sample Spring Boot API project that provides endpoints for managing users, advertisements, and categories.
- Java 17
- Docker Compose
- Clone the repository:
git clone https://github.com/amrmousa1682/spring-boot-api
- Navigate to the project directory:
cd project-directory
- Build the project:
mvn clean package
- Run the application using Docker Compose:
docker-compose up
This will start the API and its dependencies (database) using Docker Compose.
Once the application is running, you can access the API endpoints using the following base URL:
http://localhost:8080
The available endpoints are as follows:
POST /user
: Create a new user.GET /user/{id}
: Get user information by ID.PUT /user/{id}
: Update user information by ID.DELETE /user/{id}
: Delete a user by ID.
POST /advertise
: Create a new advertisement.GET /advertise
: Get all advertisements.GET /advertise/{id}
: Get advertisement information by ID.GET /advertise?prefix={prefix}
: Get advertisements by prefix.GET /advertise?categoryId={categoryId}
: Get advertisements by category ID.GET /advertise?prefix={prefix}&categoryId={categoryId}
: Get advertisements by prefix and category ID.PUT /advertise/{id}
: Update advertisement information by ID.DELETE /advertise/{id}
: Delete an advertisement by ID.
POST /category
: Create a new category.GET /category
: Get all categories.GET /category/{id}
: Get category information by ID.GET /category?prefix={prefix}
: Get categories by prefix.PUT /category/{id}
: Update category information by ID.DELETE /category/{id}
: Delete a category by ID.