The application exposes the following API endpoints:
GET /api/products/{id}
: Retrieves a product by ID.GET /api/products
: Retrieves a list of all products.POST /api/products
: Creates a new product.DELETE /api/products/{id}
: Deletes a product by ID.
The application uses H2 as the in-memory database. The database is configured using the properties in the application.properties
file.
The application can be built and run using the following command:
mvn spring-boot:run
- Install Java 21 and Maven on your machine.
- Download the project from GitHub.
- Navigate to the root directory of the project in your terminal.
- Run the following command to start the application:
mvn spring-boot:run
- Open a web browser and navigate to
http://localhost:8000
to access the API endpoints.