Method | Action |
---|---|
GET | Retrieves resources |
POST | Creates resources |
PUT | Changes and/or replaces resources or collections |
DELETE | Deletes resources |
npm install
npm start
GET /api/dining
curl http://localhost:3000/api/dining
[{
"hall_id": 1,
"hall_name": "North Campus Diner",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945"
},
{
"hall_id": 2,
"hall_name": "South Campus Dining Hall",
"hall_address": "7093 Preinkert Dr, College Park, MD 20740",
"hall_lat": "38.9832579",
"hall_long": "-76.9437231"
},
...
}]
GET /api/dining/:hall_id
curl http://localhost:3000/api/dining/1
[{
"hall_id":1,
"hall_name":"North Campus Dining Hall",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945"
}]
POST /api/dining
curl -d "hall_name=Example1&hall_address=Stamp&hall_lat=38.9923&hall_long=-76.9466" -X POST http://localhost:3000/api/dining
{
"hall_name":"Example",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945"
}
PUT /api/dining
curl -d "hall_id=4&hall_name=Example1&hall_address=Stamp&hall_lat=38.9923&hall_long=-76.9466" -X PUT http://localhost:3000/api/dining
Successfully Updated
DELETE /api/dining/:hall_id
curl -X DELETE http://localhost:3000/api/dining/4
Successfully Deleted
GET /api/meals
curl http://localhost:3000/api/meals
[{
"meal_id":1,
"meal_name":"Scrambled Eggs",
"meal_category":"B"
},
{
"meal_id":2,
"meal_name":"French Toast",
"meal_category":"B"
},
{
"meal_id":3,
"meal_name":"Pancakes",
"meal_category":"B"
},
...
]
GET /api/meals/:meal_id
curl http://localhost:3000/api/meals/1
[{
"meal_id":1,
"meal_name":"Scrambled Eggs",
"meal_category":"B"
}]
PUT /api/meals
curl -d "meal_id=1&meal_name=Scrambled Eggs&meal_category=L" -X PUT http://localhost:3000/api/meal
Successfully Updated
GET /api/macros
curl http://localhost:3000/api/macros
[{
"macro_id":1,
"calories":218,
"serving_size":20,
"cholesterol":544,
"sodium":206,
"carbs":1,
"protein":17,
"meal_id":1,
"fat":16
},
{
"macro_id":2,
"calories":371,
"serving_size":1,
"cholesterol":0,
"sodium":209,
"carbs":10,
"protein":5,
"meal_id":2,
"fat":10
},
...
]
GET /api/macros/:meal_id
curl http://localhost:3000/api/macros/1
[{
"macro_id":1,
"calories":218,
"serving_size":20,
"cholesterol":544,
"sodium":206,
"carbs":1,
"protein":17,
"meal_id":1,
"fat":16
}]
PUT /api/macros
curl -d "macro_id=1&calories=318&serving_size=20&cholesterol=544&sodium=206&carbs=1&protein=17&meal_id=1&fat=16" -X PUT http://localhost:3000/api/macros
Successfully Updated
GET /api/custom
curl --location --request GET 'http://localhost:3000/api/custom' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'query=SELECT * FROM Meals'
[{
"meal_id":1,
"meal_name":"Scrambled Eggs",
"meal_category":"B"
},
{
"meal_id":2,
"meal_name":"French Toast",
"meal_category":"B"
},
{
"meal_id":3,
"meal_name":"Pancakes",
"meal_category":"B"
},
...
]
GET /api/table/data
curl --location --request GET 'http://localhost:3000/api/table/data'
[{
"meal_name": "Scrambled Eggs",
"calories": 218,
"carbs": 1,
"sodium": 206,
"protein": 17,
"fat": 16,
"cholesterol": 544
},
{
"meal_name": "French Toast",
"calories": 371,
"carbs": 10,
"sodium": 209,
"protein": 5,
"fat": 10,
"cholesterol": 0
},
{
"meal_name": "Pancakes",
"calories": 430,
"carbs": 15,
"sodium": 111,
"protein": 4,
"fat": 15,
"cholesterol": 30
},
...
]
GET /api/map/data
curl --location --request GET 'http://localhost:3000/api/map/data'
[{
"hall_name": "North Campus Diner",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945",
"meal_name": "Scrambled Eggs"
},
{
"hall_name": "North Campus Diner",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945",
"meal_name": "Pancakes"
},
{
"hall_name": "North Campus Diner",
"hall_address": "4121 Farm Dr, College Park, MD 20742",
"hall_lat": "38.9923223",
"hall_long": "-76.9466945",
"meal_name": "Pork Sausage Link"
},
...
]