Git Product home page Git Product logo

recipes's Introduction

Recipes

About the Service

The application is just a simple multi-user RESTful service for kitchen recipes sharing. That allows to perform CRUD operations with recipes and provides Basic HTTP authentication. It uses a PostgreSQL database to store the data. You can also use any other relational database. If your database connection properties work, you can call some REST endpoints defined in localhost on port 8080. (see below)

How to Run

  • Clone this repository
  • Change the dir to the root of the project
  • Edit application.properties - set database info (db url, db driver, username, password, dialect)
  • Edit pom.xml if you use a DBMS other than postgreSQL (need to add jdbc-driver to the dependencies block)

Build :

mvn clean package

Run :

java -jar target/recipes-0.0.1-SNAPSHOT.jar

Allowed endpoints

User registration

POST /api/register

Accept: application/json
Content-Type: application/json

{
    "email" : "[email protected]",
    "password" : "example_password"
}

User authentification

To unlock the remaining endpoints, you need to log in using http basic auth. How it looks in Postman :

image

Create a recipe

POST /api/recipes/

Accept: application/json
Content-Type: application/json

{
"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 all recipes sorted by update time

GET /api/recipes/

Update a recipe

PUT /api/recipes/{id}
Accept: application/json
Content-Type: application/json

{
   "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"]
}

Delete a recipe by id

DELETE /api/recipes/{id}

Retrieve a recipe by id

GET /api/recipes/{id}

Search for recipes by name

GET /api/recipes/search/?name=Warming Ginder Tea

Search for recipes by category

GET /api/recipes/search/?category=beverage

recipes's People

Contributors

cr1spet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.