- Full Stack Web Dev & Computer Science Engineer
- My Portfolio Link
- BW POTLUCK 10/2021 BACKEND
- Author Rick Mansfield
- GO TO THE LIVE SITE
- NOTE of IMPROVEMENT...
- Base URL
- ---------------- ENDPOINTS --------------------
- -----LOGIN and REGISTER-----
- -----USERS-----
- -----POTLUCKS-----
- [GET] /api/potlucks -- get an array of potlucks
- [GET] /api/potlucks/:id -- gets potluck by ID
- [GET] /api/potlucks/:id/users -- gets the users for a specific potluck
- [GET] /api/potlucks/:id/foods -- gets the foods for a specific potluck
- [POST] /api/potlucks/:id/users -- adds a user to a potluck
- [POST] /api/potlucks/:id/foods -- adds a food item to a potluck
- [POST] /api/potlucks -- creates a new potluck
- [PUT] /api/potlucks/:id -- updates an existing potluck
- [DELETE] /api/potlucks/:id -- delete existing potluck
- [DELETE] /api/potlucks/:potluck_food_id/foods -- delete existing food item in a potluck
- -----FOODS-----
-thinking of doing this project yourself? Please notice that this was a Lambda School project. My solution is one of many possible. BEFORE you decide to use my solution know that it creates a single giant list that in it's present condition permits any user to update. In a real world app the project would need to be take father and prevent any user from updating the community foods list.
WHAT TO SEND
{
"username": "string",
"password": "string"
}WHAT YOU GET BACK
{
"username": "string",
"user_id": "integer"
}WHAT TO SEND
{
"username": "string",
"password": "string"
}WHAT YOU GET BACK
{
"message": "Welcome back username",
"user_id": "integer",
"username": "username",
"token": "TOKEN"
}WHAT YOU GET BACK
[
{
"user_id": 1,
"username": "name1"
},
{
"user_id": 2,
"username": "name2"
},
{
"user_id": 3,
"username": "name3"
}
]WHAT YOU GET BACK
{
"user_id": 1,
"username": "name1"
}WHAT YOU GET BACK
{
"user_id": "1",
"username": "name1",
"potlucks": [
{
"attending": 1,
"potluck_id": 3,
"potluck_name": "PotLuck Name you Created",
"organizer": "req.body of the name you submitted",
"potluck_description": "the description of the potluck gathering",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "08:30:00",
"potluck_location": "1817 Some address you submitted, Wi. 53024"
},
{
"attending": 1,
"potluck_id": 2,
"potluck_name": "Second PotLuck Name you Created",
"organizer": "name2",
"potluck_description": "description of the potluck gathering",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "06:00:00",
"potluck_location": "1234 Some other address you submitted, Wi. 53024"
}
]
}WHAT YOU GET BACK
[
{
"potluck_id": 3,
"potluck_name": "PotLuck Name you Created",
"organizer": 3,
"details": {
"potluck_description": "description of the potluck gathering",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "08:30:00",
"potluck_location": "1817 Some address you submitted, Wi. 53024"
}
},
{
"potluck_id": 2,
"potluck_name": "Mansfield Family BBQ",
"organizer": 3,
"details": {
"potluck_description": "Everything BBQ",
"potluck_date": "2021-07-28T06:00:00.000Z",
"potluck_time": "07:00:00",
"potluck_location": "1234 Mansfield Street, Grafton, WI. 53024"
}
}
]WHAT TO SEND
{
"username": "string",
"password": "string"
}WHAT YOU GET BACK
{
"user_id": 1,
"username": "Mr. Blah"
}WHAT YOU GET BACK
[
{
"potluck_id": 3,
"potluck_name": "PotLuck Name you Created",
"organizer": 3,
"details": {
"potluck_description": "description of the potluck gathering",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "08:30:00",
"potluck_location": "1817 Some address you submitted, Grafton Wi. 53024"
}
},
{
"potluck_id": 1,
"potluck_name": "Smith Family Chineese Food Potluck",
"organizer": 1,
"potluck_description": "Just bring Oriental Foods",
"potluck_date": "2021-08-20T06:00:00.000Z",
"potluck_time": "05:00:00",
"potluck_location": "3333 N ABC St, Grafton, WI. 53024 "
},
{
"potluck_id": 2,
"potluck_name": "Mansfield Family BBQ",
"organizer": 3,
"details": {
"potluck_description": "Everything BBQ",
"potluck_date": "2021-07-28T06:00:00.000Z",
"potluck_time": "07:00:00",
"potluck_location": "1234 Mansfield Street, Grafton, WI. 53024"
}
}
]WHAT YOU GET BACK
{
"potluck_id": 3,
"potluck_name": "Some Cool Potluck String Name",
"details": {
"organizer": "Donald",
"potluck_description": "Make the Potluck Great Again. LMAO",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "07:30:00",
"potluck_location": "1234 Mansfield Street, Grafton, WI. 53024"
}
}WHAT YOU GET BACK
{
"potluck_id": 2,
"potluck_name": "Sting Name of the Potluck",
"details": {
"organizer": 1,
"potluck_description": "String of req.body describing the potluck",
"potluck_date": "2021-10-28P06:00:00.000Z",
"potluck_time": "05:00:00",
"potluck_location": "1234 Whateveryouwrote Street, Grafton, WI. 53024"
},
"users": [
{
"user_id": 4,
"username": "Santa Klause",
"attending": "attending"
},
{
"user_id": 3,
"username": "Ms. Klause",
"attending": "not attending"
}
]
}WHAT YOU GET BACK
{
"potluck_id": 3,
"foods": [
{
"food_id": 1,
"food_name": "Ketchup",
"food_description": "It's not ordinary ok?!"
},
{
"food_id": 2,
"food_name": "Fried Rice",
"food_description": "Ok I cheated and picked it up at the grocery store"
},
{
"food_id": 6,
"food_name": "Penut Butter",
"food_description": "chuncky not smooth"
}
]
}WHAT TO SEND
{
"potluck_id": 2,
"user_id": 15,
"attending": 1 //simple 1 for attending and 0 not-attending
}WHAT YOU GET BACK
{
"potluck_id": 2,
"potluck_name": "Coming up with Names is getting old",
"details": {
"organizer": 1,
"potluck_description": "Coming up with Descriptions is getting even older",
"potluck_date": "2021-10-20P06:00:00.000Z",
"potluck_time": "05:00:00",
"potluck_location": "111 Another St. WI. 53024"
},
"users": [
{
"user_id": 4,
"username": "Mr. User Name",
"attending": "attending"
},
{
"user_id": 3,
"username": "Ms. User Name",
"attending": "not attending"
},
{
"user_id": 8,
"username": "Tom Thumb",
"attending": "attending"
}
]
}WHAT TO SEND
{
"potluck_id": 3,
"food_id": 2
}WHAT YOU GET BACK
{
"potluck_id": 3,
"foods": [
{
"food_id": 1,
"food_name": "Ketchup",
"food_description": "It's not ordinary ok?!"
},
{
"food_id": 2,
"food_name": "Fried Rice",
"food_description": "Ok I cheated and picked it up at the grocery store"
},
{
"food_id": 6,
"food_name": "Penut Butter",
"food_description": "chuncky not smooth"
}
]
}WHAT TO SEND
{
"potluck_name": "string",
"potluck_description": "string optional ",
"potluck_date": "2021-10-08 this format REQUIRED",
"potluck_time": "12:00:00 this format REQUIRED",
"potluck_location": "string",
"organizer": "integer"
}WHAT YOU GET BACK
{
"potluck_id": 3,
"potluck_name": "Lambda Graduation Bash",
"details": {
"organizer": "Rick Mansfield",
"potluck_description": "Celebrate Lambda Graduation",
"potluck_date": "2022-01-2P06:00:00.000Z",
"potluck_time": "06:30:00",
"potluck_location": "3214 Party House Way, Graftong WI. 53024"
}
}WHAT TO SEND
{
"potluck_name": "string",
"potluck_description": "string optional ",
"potluck_date": "2021-07-28 this format REQUIRED",
"potluck_time": "12:00:00 this format REQUIRED",
"potluck_location": "string",
"organizer": "integer"
}WHAT YOU GET BACK
{
"potluck_id": 3,
"potluck_name": "Lambda Graduation Bash",
"details": {
"organizer": "Rick Mansfield",
"potluck_description": "Celebrate Lambda Graduation",
"potluck_date": "2022-01-2P06:00:00.000Z",
"potluck_time": "06:30:00",
"potluck_location": "3214 Party House Way, Graftong WI. 53024"
}
}WHAT YOU GET BACK
{
"potluck_id": 3,
"potluck_name": "Lambda Graduation Bash",
"details": {
"organizer": "Rick Mansfield",
"potluck_description": "Celebrate Lambda Graduation",
"potluck_date": "2022-01-2P06:00:00.000Z",
"potluck_time": "06:30:00",
"potluck_location": "3214 Party House Way, Graftong WI. 53024"
}
}WHAT YOU GET BACK
"successfully removed item"WHAT YOU GET BACK
[
{
"food_id": 1,
"food_name": "Ketchup",
"food_description": "It's not ordinary ok?!"
},
{
"food_id": 2,
"food_name": "Fried Rice",
"food_description": "Ok I cheated and picked it up at the grocery store"
},
{
"food_id": 6,
"food_name": "Penut Butter",
"food_description": "chuncky not smooth"
}
]WHAT YOU GET BACK
{
"food_id": 1,
"food_name": "Ketchup",
"food_description": "It's not ordinary ok?!"
}WHAT TO SEND
{
"food_name": "Chips",
"food_description": "string optional"
}WHAT YOU GET BACK
{
"food_id": 8,
"food_name": "Chips",
"food_description": "description submitted"
}WHAT TO SEND
{
"food_name": "Pickles",
"food_description": "string optional"
}WHAT YOU GET BACK
{
"food_id": 8,
"food_name": "Pickles",
"food_description": "description if you subbitted one"
}WHAT YOU GET BACK
{
"food_id": 8,
"food_name": "Name of the deleted food",
"food_description": "description if one was submitted"
}