A simple Spring Boot REST API for managing food items.
This API allows you to create, read, and delete food resources.
- List all food items
- Get a food item by ID
- Add a new food item
- Delete a food item by ID
-
Make sure you have Java and Maven installed.
-
Clone the repository.
-
Run the app using Maven:
./mvnw spring-boot:run
-
The API will be available at:
http://localhost:8080/api/food
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/food |
List all food items |
| GET | /api/food/{id} |
Get food item by ID |
| POST | /api/food |
Add a new food item |
| DELETE | /api/food/{id} |
Delete food item by ID |
{
"name": "Apple",
"calories": 95
}- This project uses an in-memory H2 database by default.
- You can access the H2 console at
http://localhost:8080/h2-console(if enabled).
Created by Ermithe Tilusca