Coder Social home page Coder Social logo

recipeswebproject's Introduction

RecipesWebProject

A Simple Web Service to create and save recipes. Made using SpringBoot for the backend and Angular for the frontend

Database

The database is written in MySQL and is formed by three tables:

  • recipes with attributes:
    • id (primary key)
    • title
    • date_of_creation (datetime)
    • serving
    • description (nullable)
    • time
    • difficulty (enum)
    • photo (nullable, LONGTEXT to save the base64 string of the image)
  • ingredients with attributes:
    • id (primary key)
    • name
    • quantity
    • unit_of_measurement
    • recipe_id (foreign key, relationship N:1 with recipes)
  • steps with attributes:
    • id (primary key)
    • step_number (must be unique in the same recipe)
    • title
    • description
    • recipe_id (foreign key, relationship N:1 with recipes)

Backend (REST API)

RecipesStorage - RESTapi This is a REST API to manage a storage of recipes. It is written in Java using Spring Boot and Spring Data JPA and is available ad http://localhost:8080
The API allows to make the following CRUD calls (the results are in JSON format)
All of the values are validated before saving them in the database. If a value is not valid, the API returns an error message (tipically an error 400: bad requests, or 404: not found).

A post request for a recipe must specify: {
"title": "YourRecipeTitle",
"serving": servingNumber,
"time": timeInMinutes,
"difficulty": "Easy or Medium or Hard",
}

A post request for a recipe can also specify {
"description": "YourRecipeDescription",
"photo": "YourRecipePhotoBase64String"
}

A post request for an ingredient must specify {
"name": "YourIngredientName",
"quantity": ingredientQuantity,
"unitOfMeasurement": "YourUnitOfMeasurement"
}

A post request for the step must specify {
"stepNumber": stepNumber,
"title": "YourStepTitle",
"description": "YourStepDescription"
}


Most important files of the application:

  • RecipeStorageApplication.java: the main class of the application
  • Entities: the classes that represent the entities of the database
  • Repositories: the interfaces that extend the JpaRepository interface (provided by Spring Data JPA) and allow to make CRUD calls
  • Controllers: the classes that manage the requests and the responses
  • httpRequests: used to test the API with multiple calls

Frontend (Angular)

The frontend is made in Angular, it can be started with 'ng serve' and is available ad http://localhost:4200

recipeswebproject's People

Contributors

dream-19 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.