Prerequisites
To set up your own development system, ensure you have the following:
- A GitHub account
- Git
- node.js
- json-server
- curl
- Text editor (for example, GitHub Desktop)
Copy the Touch Grass Repository
The Touch Grass API is an open service and available to multiple subscribers. To ensure data is not inadvertently changed between subscribers, create a copy of the repository for your own use.
Test the JSON Server
To ensure the service works on your local computer, perform the following test:
- Open Git Bash.
- Navigate to the cloned repository.
- Navigate to the .json file.
cd api - Enter the following:
json-server -w touch-grass-db-source.json - Note the “Home” domain in the response. For example:
\{^_^}/ hi! Loading touch-grass-db-source.json Done Resources http://localhost:3000/parks http://localhost:3000/visitors Home http://localhost:3000 - Without closing the current Git Bash window, open a new Git Bash window.
- Run a test
GETrequest. For example:curl http://localhost:3000/parksIf you see a response with park information, the test is successful. For example:
[ { "park_name": "Channel Islands National Park", "location": "Ventura, California", "habitat": "coastal and marine", "fun fact": "The Channel Islands are home to the island fox, which is an endemic species found nowhere else on Earth.", "website": "https://www.nps.gov/chis/index.htm", "id": 1 }, { "park_name": "Sequoia & Kings Canyon National Parks", "location": "Three Rivers, California", "habitat": "forests", "fun fact": "Sequoia and Kings Canyon are home to nearly 300 native animal species, including the alpine chipmunk.", "website": "https://www.nps.gov/seki/index.htm", "id": 2 } ]