/recipe-api

Primary LanguageJavaScript

Recipe Database

Click to visit the API.
Click to visit the docsified version of this README.

Recipe Database (RD) stores and displays user-entered recipes.

Usage

  1. Post to /users to create an account
  2. Get /users to find account _id
  3. Request /recipes to see all recipes
  4. Post to /recipes to add a recipe associated with your user _id

Endpoints

GET https://bew-recipe-api.herokuapp.com/users - Returns all users in the database (excludes associated passwords)
POST https://bew-recipe-api.herokuapp.com/users - Create a new user
GET https://bew-recipe-api.herokuapp.com/users/<id> - Returns specific user's account details (excluding password)
DELETE https://bew-recipe-api.herokuapp.com/users/<id> - Delete a specific user
PUT https://bew-recipe-api.herokuapp.com/users/<id> - Updates a specific user's account details

GET https://bew-recipe-api.herokuapp.com/recipes - Returns all stored recipe titles
POST https://bew-recipe-api.herokuapp.com/recipes - Submits form with recipe details to the database
GET https://bew-recipe-api.herokuapp.com/recipes/<id> - Returns specific recipe's details
DELETE https://bew-recipe-api.herokuapp.com/recipes/<id> - Delete a specific recipe
PUT https://bew-recipe-api.herokuapp.com/recipes/<id> - Update a specific recipe

Examples

GET https://bew-recipe-api.herokuapp.com/recipe

{
    "allRecipes": [
        {
            "_id": "608a34530141c496e86440de",
            "title": "test recipe 1",
            "ingredients": "ingredient 1, ingredient 2",
            "method": "step 1, step 2",
            "author": "608a2f603e53ef93f3845970",
        },
        {
            "_id": "608a3487ed9a17972dc98e4f",
            "title": "test recipe 1",
            "ingredients": "ingredient 1, ingredient 2",
            "method": "step 1, step 2",
            "author": "608a30703cb2b09453f7d8c3",
        },
        ...
    ]
}

GET http://site.com/recipe/<id>

{
    'name': 'Chili de Jackie',
    'ingredients': ['1 can of chili from Target'],
    'method': ['Open the can', 'Eat what\'s inside the can.'],
    'author': {
        'username': 'user1',
        'recipes': ['Chili de Jackie']
    }
}