![Byte logo](src/main/resources/img/byte-logo.png)
![Byte logo](src/main/resources/img/youtube.png)
This is a simple Spring Boot REST API for managing menu item data. The application uses PostgreSQL as the database
These instructions will help you set up and run the project on your local machine.
- Java Development Kit (JDK) installed (version 17 or later)
- PostgreSQL installed and running
- *you can pick another database, but you'll have to do the
necessary changes in
pom.xml
andapplication.properties
- *you can pick another database, but you'll have to do the
necessary changes in
- Your favorite IDE (preferably IntelliJ) installed and running
-
Clone the repository:
git clone https://github.com/abdelhalimjean/Bean-and-Berry-Spring-Boot-REST-API
-
Open the project folder in your favorite IDE
-
Open
src/main/resources/application.properties
and update the PostgreSQL connection properties if needed. -
Ensure that the PostgreSQL server is running, and create the database
BeanAndBerry
and a user and password as mentioned in theapplication.properties
file. -
After running
SpringBootRestApiApplication.java
the application will be accessible at http://localhost:8080/ (you will see a "Whitelabel Error Page" don't worry, that's what's supposed to happen, it means everything is working) -
After running the application, the tables will be automatically created, only then can you run the data initialization scripts.
The project includes an initial data script at src/main/resources/insert_menu_items.sql
.
You can execute this scripts in your database to have some data to play with, otherwise you'll have to insert the data yourself.
URL: /api/menu/all
Method: GET
Description: Retrieve a list of all menu items.
URL: /api/menu/search?keyword=chocolate&category=cake
Method: GET
Description: Retrieve a list of menu items based on the keyword (name or ingredient) and category.
URL: /api/menu/{id}
Method: GET
Description: Retrieve details of a specific menu item by its ID.
URL: /api/menu
Method: POST
Description: Add a new menu item to the database.
URL: /api/menu/{id}
Method: PUT
Description: Update details of a specific menu item by its ID.
URL: /api/menu/{id}
Method: DELETE
Description: Delete a specific menu item by its ID.
URL: /api/menu/bulk
Method: POST
Description: Add a new menu item to the database.
Abdelhalim Jean