Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

kallmetony/RecipeWebService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipe Web Service

REST Web service that allows registered users

  • Save their recipes
  • Update their recipes
  • Delete their recipes
  • Search for others recipes

API

Register a new user

  POST /api/signup

Request body

{
    "email" : "admin@example.com",
    "password" : "p4ssword"
}

Add a new recipe

  POST /api/recipe/new

Request body

{
    "name" : "Fresh Mint Tea",
    "category" : "beverage",
    "description": "Light, aromatic and refreshing beverage, ...",
    "ingredients": ["boiled water", "honey", "fresh mint leaves"],
    "directions": ["Boil water", "Pour boiling hot water into a mug", "Add fresh mint leaves", 
        "Mix and let the mint leaves seep for 3-5 minutes", "Add honey and mix again"]
}

Get a recipe

  GET /api/recipe/{id}
Parameter Type Description
id @Path Required. Id of recipe to fetch

Returns recipe with specified id.

Get all recipes

  GET /api/recipe/all

Returns all recipes

Search recipes by category or name

  GET /api/recipe/search
Parameter Type Description
category string Not required. Category of a recipe to fetch
name string Not required. Name of a recipe to fetch

Returns a recipe with specified category or name.

Delete a recipe

  DELETE /api/recipe/{id}
Parameter Type Description
id @Path Required. Id of recipe to delete

Deletes recipe with specified id.

Update a recipe by category or name

  PUT /api/recipe/{id}
Parameter Type Description
id @Path Required. Id of recipe to update

Request body

{
    "name": "Warming Ginger Tea",
    "category": "beverage",
    "description": "Ginger tea is a warming drink for cool weather, ...",
    "ingredients": ["1 inch ginger root, minced", "1/2 lemon, juiced", "1/2 teaspoon manuka honey"],
    "directions": ["Place all ingredients in a mug and fill with warm water (not too hot so you keep the beneficial honey compounds in tact)", 
        "Steep for 5-10 minutes", "Drink and enjoy"]
}

Updates recipe with specified id.

Compile

  1. Navigate to the project directory
    cd <project-name>
  1. Execute maven tasks
    ./mvnw clean package
  1. Jar file wil be located in the /target folder

Run

  1. Go to the project directory
  cd /target
  1. Start the application
  java -jar RecipeWebService-1.1.jar