Skip to content

CRUD api for restaurant, restaurant menu and menu options

Notifications You must be signed in to change notification settings

KU-Wongnai/restaurant-service

Repository files navigation

KU Wongnai - Restaurant Service

CRUD api for restaurant, restaurant menu and menu options

Table of Contents

Built With

  • Spring
  • Spring Boot

Setup

  1. Clone the repo

    git clone https://github.com/KU-Wongnai/restaurant-service.git
  2. Copy .env.example to .env and change the value to your environment.

    cp .env.example .env

    In your .env file add your jwt key to JWT_SECRET which should come from user-service

    JWT_SECRET=<your-jwt-key>
  3. Run the following command to start MySQL Server at port 3307.

    docker-compose up -d
  4. Run RestaurantApplication.java to start the service

    mvn spring-boot:run

API

Service runs at http://localhost:8092

Restaurant

Make sure to create a restaurant before creating a menu

Create

POST -> http://localhost:8092/api/restaurants

{
    "name" : "Sushi Power",
    "description" : "Have some sushi",
    "location" : "Bangkhen",
    "foodType" : "Japanese",
    "operatingHours" : 3,
    "contactInfo" : "0998765431",
    "rating" : 4.8
}

Show All Restaurants

GET -> http://localhost:8092/api/restaurants

Find Restaurant by ID

GET -> http://localhost:8092/api/restaurants/{restaurantId}

Update Restaurant

PUT -> http://localhost:8092/api/restaurants/{restaurantId}

{
    "name": "Teenoi",
    "description": "Have some shabu",
    "location": "Ladprao",
    "foodType": "Thai",
    "operatingHours": 4,
    "contactInfo": "0998765432",
    "image": null,
    "rating": 4.9
}

Delete Restaurant

DELETE -> http://localhost:8092/api/restaurants/{restaurantId}

(back to top)

Menu

Make sure to create a restaurant before creating a menu

Create Menu

POST -> http://localhost:8092/api/restaurants/{restaurantId}/menu

{
  "name" : "Sushi",
  "description" : "Very delicious",
  "price" : 250,
  "category" : "Japanese"
}

Show All Menus

GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu

Find Menu by ID

GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}

Update Menu

PUT -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}

{
  "name" : "Sashimi",
  "description" : "Super delicious",
  "price" : 500,
  "category" : "Japanese"
}

Delete Menu

DELETE -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}

(back to top)

Menu Option

Make sure to create a menu before creating a menu option

Create Menu Option

POST -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options

{
  "name" : "Cheese",
  "price" : 10,
  "category" : "Extra"
}

Show All Menu Options

GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options

Find Menu Option by ID

GET -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}

Update Menu Option

PUT -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}

{
  "name" : "Miso",
  "price" : 25,
  "category" : "Extra"
}

Delete Menu Option

DELETE -> http://localhost:8092/api/restaurants/{restaurantId}/menu/items/{menuId}/options/{menuOptionId}

(back to top)

About

CRUD api for restaurant, restaurant menu and menu options

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published