Skip to content

304cem-1920SEPJAN/backend-coursework-304CEM

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db
 
 
 
 
 
 
 
 

Documentation

Create a recipe

Creates an authors recipe

URL http://localhost:8080/api/v1.0/recipe/create

Method POST

URL Params None

Data Params

Required

title=[string]

subtitle=[string]

description=[string]

authorId=[integer]

steps=[array[{description:string, number:integer, recipeId:integer}]]

Optional

categoryId=[integer]

files=[array]

Success Response 201

Error Response 404

Example

fetch('http://localhost:8080/api/v1.0/recipe/create, {
    method: 'POST',
    data: {
            title: 'Cheesecake',
            subtitle: 'The best cheesecake ever',
            categoryId: 5,
            authorId: 1,
            steps: [{
                description: 'Mix ingredients',
                number: 1,
                recipeId: 1
            }, {
                description: 'Put it in the fridge',
                number: 2,
                recipeId: 1
            }]
        }
    }) 
    .then((data) => {
        //do something
    })

Update recipe

Updates an authors recipe

URL http://localhost:8080/api/v1.0/recipe/update

Method POST

URL Params None

Data Params

Required

id=[integer]

title=[string]

subtitle=[string]

description=[string]

steps=[array[{description:string, number:integer, recipeId:integer}]]

Optional

categoryId=[integer]

files=[array]

Success Response 200

Error Response 404

Example

fetch('http://localhost:8080/api/v1.0/recipe/update, {
    method: 'PUT',
    data: {
            title: 'Cheesecake',
            subtitle: 'The best cheesecake ever',
            categoryId: 5,
            authorId: 1,
            steps: [{
                description: 'Mix ingredients',
                number: 1,
                recipeId: 1
            }, {
                description: 'Put it in the fridge',
                number: 2,
                recipeId: 1
            }]
        }
    }) 
    .then((data) => {
        //do something
    })

Get latest recipes

Fetch the latest recipes from the database with passing in optional page number paramater

URL /api/v1.0/recipe/latest

Method GET

URL Params page=[integer]

Data Params None

Success Response 200

Error Response 404

Example

fetch('http://localhost:8080/api/v1.0/recipe/latest?page=1')
    .then((data) => {
        //do something
    })

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published