This is the back-end API for KitchenMenu - it is used to perform CRUD operations on the KitchenMenu database in order to register/login users, bookmark/unbookmark recipes, add/remove meals from a user's meal tracker, and edit user info.
API URL: https://www.kitchen-menu.com/
npm install
jest user.test.js
jest auth.test.js
jest users.test.js
- /users/ (sample response body below)
[
{
"username": "testuser",
"email": "firstlast@gmail.com",
"first_name": "Bob",
"last_name": "Smith"
},
{
"username": "testuser2",
"email": "anotheruser@gmail.com",
"first_name": "Jane",
"last_name": "Doe"
}
]
- /users/:username (sample response body below)
{
"username": "testuser",
"email": "firstlast@gmail.com",
"first_name": "First",
"last_name": "Last",
"bookmarks": [ 716426 ],
"eatenMeals": { 652423 }
}
- /users/:username/getAllBookmarks (sample response body below)
[ 716426 ] // this id is used to get recipe details through Spoonacular API
- /users/:username/getEatenMeals (sample response body below)
{ 652423 } // this id is used to get recipe details through Spoonacular API
- /auth/register (sample request body below)
{
"username": "testuser",
"password": "password123",
"first_name": "Bob",
"last_name": "Smith",
"email": "testuser@gmail.com",
"weight": 175,
"weight_goal": 160,
"calorie_goal": 2000
}
- /auth/login (sample request body below)
{
"username": "testuser",
"password": "password123"
}
- /users/bookmarkRecipe (sample request body below)
{
"username": "testuser",
"recipeId": 652423
}
- /users/unbookmarkRecipe (sample request body below)
{
"username": "testuser",
"recipeId": 652423
}
- /users/addEatenMeal (sample request body below)
{
"username": "testuser",
"recipeId": 652423
"date": "2021-04-09",
"nutrients": {
"calories": 484,
"carbs": 53,
"fat": 25,
"protein": 14
}
}
- /users/removeEatenMeal (sample request body below)
{
"username": "testuser",
"recipeId": 652423,
"date": "2021-04-09"
}
- /users/:username (sample request body below)
{
"username": "testuser",
"email": "testuser@gmail.com",
"first_name": "Bobby",
"last_name": "Smith",
"weight": 180,
"weight_goal": 170,
"calorie_goal": 2000
}
- /users/:username