California is the third largest state in the United States and its state and national parks are spread throughout its entire area. Sometimes, geographic and transportation limitations affect where to you may want to go.
The Touch Grass service contains information about state and national parks in California. In order to access the information, follow the GitHub instructions to clone the GitHub repository.
The service currently requires a local JSON server to make API calls. The server runs in a Git Bash instance, but API calls must be performed in a separate window or program.
Open Git Bash.
Navigate to the cloned folder.
Navigate to the /api
folder.
Enter json-server -w touch-grass-db-source.json
.
Open Postman.
Set the method to GET.
Enter the following URL and select Send. The park location is identified by the location
attribute.
{base URL}/parks?park_name={name of the desired park}
For example, to look up the location of Joshua Tree National Park, enter the following:
http://localhost:3000/parks?park_name=Joshua%20Tree%20National%20Park
This produces the following response:
[
{
"park_name": "Joshua Tree National Park",
"location": "Twentynine Palms, California",
"habitat": "deserts",
"fun fact": "Two distinct desert ecosystems, the Mojave and the Colorado, come together in Joshua Tree National Park.",
"website": "https://www.nps.gov/jotr/index.htm",
"id": 3
}
]
The location of Joshua Tree National Park is Twentynine Palms, California.
NOTE: The default domain is localhost:3000
, but it can be changed. To verify the domain, check the JSON server introductory text when it was started.