Skip to content

secret-family-recipes-bw/back-end

Repository files navigation

😺 Welcome to the Secret Family Recipe Read me! 😺

🍱 🍜 🥧 🍪 🍹 🌮 🥙 🌯 🍕 🥗 🥣 🥘 🍟 🍳 🥟 🍝 🥮

:trollface:

Some Links:
API | Client | Marketing | Documentation | End Points | Data Model |

1

📜 API Documentation 📜

🛠️ Backend Framework Used 🔐

  • Node 🏴‍☠️
    • Express.js 🏳️

:atom: Data Model :electron:

click on picture for bigger image if this is hard to read

1

Users

{
   id: INT
   username: STRING
   password: STRING
   email: STRING
   name: TEXT
}

Recipes

{
  id: INT
  user_id: INT
  title: STRING
  source: STRING
  category: STRING
  image: STRING
}

Ingredients

{
  id: INT
  name: STRING
}

Instructions

{
  id: INT (not string, image hasn't been updated)
  recipe_id: INT
  step_number: INT
  step: TEXT(700)
}

RecipeServices

{
  id: INT
  recipe_id: INT
  ingredients_id: INT
  quantity: floating number
}

🔜 End Points 🔚

Method End point Description
POST /auth/register Registers a user.
POST /auth/login Logs the user in and returns a token.
GET /auth/users returns a list of users usernames and name.
GET /auth/users/:id returns a user by their ID.

POST LOGIN RESPONSE

{   //Bellow is the response you get from logging in succesfully
    "message": "Welcome to our API",
    "token": "this will be a hashed value auto generated"
}

GET USERS RESPONSE

{
         //Bellow is the data you get back from the GET for users
        "username": "TestUser1",
        "name": "John Doe"
    }

Recipes End points

Method End point Description
POST /recipes/addrecipe Adds a new Recipe.
POST /recipes/:id/addingredient/ Adds an ingredient to a Recipe with the quantity amount for a specific recipe.id.
PUT /recipes/updaterecipe/:id Update an existing recipe by the recipe ID.
DELETE /recipes/:id Deletes an existing recipe by the recipe ID.
GET /recipes/:id returns a recipe by the given ID + instructions
GET /recipes/:id/instructions returns a list of instructions for a specific recipe
GET /recipes returns a list of recipes.
GET /recipes/ingredients/:id/ returns the ingredient ID, Ingredient name, and the recipe information of which that ingredient is used in.
Add Recipe
{
    "user_id":"3", //user that made the recipe (required)
    "title":"test recipe", //name of your desired recipe (required)
    "source":"testingsource", //source (required)
    "category":"lunch" //desired category (required)
    "image": "string formate" // may change default from null (if left empty) to a generic SFR Logo/image
}
Add Ingredient
{
   "name":"name of your ingredient",
   "quantity" : "numeric value you desire"
}
Update Recipe by ID (all fields required except image, which can be left empty)
{
    "user_id":"3",
    "title":"test recipe updated",
    "source":"testingsource",
    "category":"lunch"
}

🍱 🍜 🥧 🍪 🍹 🌮 🥙 🌯 🍕 🥗 🥣 🥘 🍟 🍳 🥟 🍝 🥮

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published