forked from aloofcaterpillars/aloofcaterpillars
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path_apiRoutes.js
22 lines (21 loc) · 9.63 KB
/
_apiRoutes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| URL | Method | Why? | Request | Response Data | Codes |
|:------------------------------:|:------:|----------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|------------------------------------------|
| '/boorish/users/:id' | GET | Retrieve a user | { username: String } | { username: String, foodTokens: Number, displayName: String } | 200, OK 404, Not found |
| '/boorish/users' | POST | Create a new user | { username: String, password: String } | { authToken: String } | 200, OK |
| '/boorish/users/:id' | DELETE | Remove a user from the database | { username: String, password: String } | | 200, OK 401, Unauthorized |
| '/boorish/signin' | POST | User signs in | { username: String, password: String } | { username: String, displayName: String, authToken: String } | 200, OK 401, Unauthorized |
| '/api/users/signedin' | GET | Check user authorization | No data | Status Code | 200, OK 401, Unauthorized |
| | | | | | |
| '/boorish/meals' | GET | Retrieve all available meals | No data | { meal_id: String, imgUrl: String, description: String, title: String, ingredients: Array, creator: String, eaters: Array, date_available: Number, portions: Number, tags: Array } | 200, OK |
| '/boorish/meals' | POST | Add a new meal to the database | { imgUrl: String, description: String, title: String, ingredients: Array, creator: String, date_available: Number, portions: Number, tags: Array } | No data | 200, OK 401, Unauthorized |
| '/boorish/meals' | PUT | Edit a meal | { imgUrl: String, description: String, title: String, ingredients: Array, creator: String, date_available: Number, portions: Number, tags: Array } | No data | 200, OK 401, Unauthorized |
| '/boorish/meals/:id' | DELETE | Delete a meal from the database | { meal_id: String } | No data | 200, OK 404, Not found |
| | | | | | |
| '/boorish/meals/users/:id' | GET | Get all meals where a user is a creator or eater | params.id (user) | { created: { current: Array, past: Array }, eating: { current: Array, past: Array } } | 200, OK 404, Not found |
| '/boorish/meals/:id/users/:id' | POST | Add a meal to a user's list | params.id (meal) and params.id (user) | No data | 200, OK 404, Not found |
| '/boorish/meals/:id/users/:id' | PUT | Remove a meal from a user's current list | params.id (meal) and params.id (user) | No data | 200, OK 404, Not found |
| | | | | | |
| '/boorish/feedback/meals/:id' | GET | Retrieve the feedback from a specific meal | params.id (meal) | { meal_id: String, ratingOne: Number, ratingTwo: Number, ratingThree: Number } | 200, OK 404, Not found |
| '/boorish/feedback/meals/:id' | POST | Give feedback on a meal | params.id (meal) and { ratingOne: Number, ratingTwo: Number, ratingThree: Number } | No data | 200, OK 404, Not found |
| '/boorish/feedback/meals/:id' | PUT | Edit feedback on a meal | params.id (meal) and { ratingOne: Number, ratingTwo: Number, ratingThree: Number } | No data | 200, OK 404, Not found, 401, Unauthorized|
| | | | | | |