CRUD api for restaurant, restaurant menu and menu options
-
Clone the repo
git clone https://github.com/KU-Wongnai/restaurant-service.git
-
Copy
.env.example
to.env
and change the value to your environment.cp .env.example .env
In your
.env
file add your jwt key toJWT_SECRET
which should come from user-serviceJWT_SECRET=<your-jwt-key>
-
Run the following command to start MySQL Server at port 3307.
docker-compose up -d
-
Run
RestaurantApplication.java
to start the servicemvn spring-boot:run
Service runs at http://localhost:8092
Make sure to create a restaurant before creating a menu
{
"name" : "Sushi Power",
"description" : "Have some sushi",
"location" : "Bangkhen",
"foodType" : "Japanese",
"operatingHours" : 3,
"contactInfo" : "0998765431",
"rating" : 4.8
}
{
"name": "Teenoi",
"description": "Have some shabu",
"location": "Ladprao",
"foodType": "Thai",
"operatingHours": 4,
"contactInfo": "0998765432",
"image": null,
"rating": 4.9
}
DELETE -> http://localhost:8092/api/restaurants/{restaurantId}
Make sure to create a restaurant before creating a menu
POST -> http://localhost:8092/api/restaurants/{restaurantId}/menu
{
"name" : "Sushi",
"description" : "Very delicious",
"price" : 250,
"category" : "Japanese"
}
GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu
GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}
PUT -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}
{
"name" : "Sashimi",
"description" : "Super delicious",
"price" : 500,
"category" : "Japanese"
}
DELETE -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}
Make sure to create a menu before creating a menu option
POST -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options
{
"name" : "Cheese",
"price" : 10,
"category" : "Extra"
}
GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options
GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}
PUT -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}
{
"name" : "Miso",
"price" : 25,
"category" : "Extra"
}
DELETE -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}