Our website will help anyone who is traveling to National Parks in the US and is looking to view or leave reviews for various places and attractions
This website has been developed for modern desktop and mobile web clients. It should be compatible with chromium based browsers, Safari, or Internet Explorer.
https://group2-project377.herokuapp.com/
To use this website, fork the code to a local repository and install dependancies using: npm install after Node.js has been installed
Start the server using: npm start
Access the site by navigating to localhost:3000
Below are details of the API contained within this piece of labwork.
| Method | Action |
|---|---|
| GET | Retrieves resources |
| POST | Creates resources |
| PUT | Changes and/or replaces resources or collections |
| DELETE | Deletes resources |
GET /api/race
curl http://localhost:3000/api/race
{
"parks": [
{
"park_id": 1,
"park_name": "Assateague Island",
"trails": "none",
"park_lat": 37.901984,
"park_long": 75.3526373
},
{
"park_id": 2,
"park_name": "National Mall",
"trails": "none",
"park_lat": 38.887161,
"park_long": 77.037331
},
{
"park_id": 3,
"park_name": "Grand Canyon",
"trails": null,
"park_lat": 36.056595,
"park_long": 112.125092
}
]
}
PUT /api/race/
curl -d "park_id=4&park_name=Example1&trails=trail&park_lat=0&park_long=1" -X PUT http://localhost:3000/api/race/
Successfully updated
GET /api/race/reviews
curl http://localhost:3000/api/race/reviews
{
"reviews": [
{
"review_id": 1,
"park_id": 1,
"title": "Great trails",
"author": "Race",
"description": "super fun "
},
{
"review_id": 2,
"park_id": 2,
"title": "Great trails",
"author": "Race2",
"description": "super fun "
}
]
}
GET /api/race/reviews/:park_id
curl http://localhost:3000/api/race/reviews/1
[ { "review_id": 1, "park_id": 1, "title": "Great trails", "author": "Race", "description": "super fun " } ]
POST /api/race/reviews
curl -d "park_id=1&title=Great Trails&author=Race&description=Trails were fun" -X POST http://localhost:3000/api/race/reviews
[ { "review_id": 1, "park_id": 1, "title": "Great trails", "author": "Race", "description": "Trails were fun" } ]
DELETE /api/race/reviews:id
curl -X DELETE http://localhost:3000/api/race/reviews/1
Successfully deleted