Git Product home page Git Product logo

sils490-paleorecipebookapi's Introduction

sils490-PaleoRecipeBookAPI

** Homework Assignment 5: Designing a Hypermedia Type: Paleo Recipe Book; Final**


The following html documents are used to build this project:

list-recipes.ejs, list-ingredients.ejs, one-recipe.ejs, one-ingredient.ejs, index.ejs, app.js

This information (web) service handles Paleo Recipes and Paleo Ingredients ,that are by definition “Paleo”, as its two resources. These recipes do not contain grains, dairy, processed sugar/preservatives, corn or corn byproducts, legumes, or white/starchy potatoes, and only contain fruits, vegetables, meats, and natural sugars.

Each recipe can be divided into data units made up of the following sections: Recipe Title, Ingredients, Main Ingredient, Prep Instruction, Cooking Instruction, Author Comment, and Comments. These are the components that the service will require information about for each resource.

This API will handle the following representation:

1. The list of All Recipes by title: /title

From here the user can navigate to view a single recipe, the list of all recipes, the list of all ingredients, or go back to the home page.

GET returns a list of all recipe Titles. Requires no representations from the user. If there are no recipes, it returns the message:’ no recipes have been created.’.The status code is 200 ok.

POST creates a new recipe. This requires text representations of the Recipe Title, and Id; text representation of Ingredients, Prep Instruction, Cooking Instruction, Main Ingredient, Author Comments, and Comments are optional for this form. If valid, it returns the new objects location: /recipe/{recipe title}. The status code is ‘201 created’ if the request is valid, all necessary data is provided, or ‘400 Bad Request’ if no data or not all data was provided in the request.

2. A sigle recipe identifiable by a recipe Title: /recipe/{recipe title}

From here the user can navigate to view all the main ingredients associated with this single recipe, the list of all recipes, the list of all ingredients, or go back to the homepage.

GET returns a text representation of the recipe which is specified by the Title. This requires the user to provide a text representation of the Title. If there is no recipe with the specified title, it returns the message: ‘no such recipe’. The status code is ‘200 ok’ if all necessary data is provided.

POST updates or adds comments, ingredients, prep time, or cook instructions, or all the above to the recipe. This requires the user to provide a text representation of each or any of these items. It returns the message: ‘comment added to recipe {title}'.The status code is ‘200 ok’.

3. The list of All Main Ingredients: /ingredien/{main_ingredient}

From here the user can navigate to view a single ingredient, the list of all recipes, the list of all ingredients, or go back to the home page.

GET returns a list of all main ingredients without duplicates. Requires no representations from the user. If there are no recipes, it returns the message:’ no recipes have been created.’.The status code is 200 ok.

PUT creates a new ingredient for a recipe. This requires text representations of the ingredient, however, the recipe's ID and Title are dynamically provided by the application. If valid, it returns the new objects location: /ingredietn/{main_ingredient}. The status code is ‘201 created’ if the request is valid, all necessary data is provided, or ‘400 Bad Request’ if no data or not all data was provided in the request.

4. A sigle Main Ingredient identifiable associated with a recipe Title: /ingredient/{main_ingredient}

From here the user can navigate to view all the recipes titles associated with this single ingredient, the list of all recipes, the list of all ingredients, or go back to the homepage.

GET returns a text representation of the ingredinet which is specified by it's name. This requires the user to provide a text representation of the ingredient. If there is no recipe with the specified title, it returns the message: ‘no such recipe’. The status code is ‘200 ok’ if all necessary data is provided.


##Attribut values: id, class, rel, name

id attribute values:

all-recipes: When used with a div tag specifies a resource that should represent all recipe titles of recipes

all-ingredients: When used with a div tag specifies a resource that should represent all ingredients of recipes

class attribute values:

navigation: signifies a link the user can use to navigate across representations

titles: When used with ul tag signifies a list of recipes that can be identified by title

recipe-text: When used with a span tag defines a block of text data that is about a recipe

control: When used with a form tag signifies that this is a method to control the flow of data

one-recipe: When used with ul tag signifies a single recipe

one-ingredient: When used with ul tag signifies a single recipe

rel attribute values:

home-page: Refers to a process flow that takes the user to home page.

all-recipes: Refers to a process flow that takes the user to the list of all recipes.

all-ingredient: Refers to a process flow that takes the user to the list of all ingredients

title: When used with an a tag directs the data to refer to a title

ingredients: When used with an a tag directs the data to refer to ingredients

prep: When used with an a tag directs the data to refer to prep instructions

cooking-instructions: When used with an a tag directs the data to refer to cooking instructions

comments: When used with an a tag directs the data to refer to comments

authors-comments: When used with an a tag directs the data to refer to the authors original comments

name attribut values:

all-recipe-titles: When used with form signifies a method that returns all recipe titles

add-recipe: When used with form signifies a method that adds a recipe

title: When used with an input tag specifies the the user's input should represent a recipe's title

add-ingredient: When used with an input tag specifies the the user's input should represent a recipe's ingredients

update-recipe: When used with form signifies a method that should update a recipe with comments given as input by the user

sils490-paleorecipebookapi's People

Contributors

stewartt avatar

Watchers

James Cloos avatar  avatar

sils490-paleorecipebookapi's Issues

Links to undefined resources

recipe.html links to resources for "title", "ingredients", "prep-instructions", "cooking instructions", and "comments," but you didn't define any of these resources in your previous assignment. I would not advise making these things separate resources, but instead including them in the representation of a recipe. It's possible that you might want to have separate /{category}/{type}/{title}/comments and /{category}/{type}/{title}/comments/{comment-num} resources so that comments could be more easily added and deleted, but I wouldn't worry about that for this assignment.

No way to update recipe

In the previous assignment you wrote that "PUT replaces/update/add comments to some contents of the recipe" but you have not provided a form to do this. In recipe.html you have a form, but it only has a comment field—it needs to have fields for all the properties of a recipe.

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.