Set up the development environment for PawFinder tutorials.
Estimated preparation: ~20 minutes.
Open the links in separate browser tabs before installing any software.
json-serverPostman desktop app: desktop version required; web version incompatible with http://localhost
Tip: while using a fork of the repository, create a working branch in which to complete the tutorials. Create a new branch for each tutorial to prevent a mistake in one from affecting any work in another.
graph LR
A["Prerequisites"]
B["Fork &<br/>Clone"]
C["Install"]
D["Start"]
E["Test"]
F["✓ Ready"]
A --> B
B --> C
C --> D
D --> E
E --> F
style A fill:#9989c4,stroke:#333,stroke-width:2px,color:#fff,font-family:Helvetica
style B fill:#88b2c4,stroke:#333,stroke-width:2px,color:#fff,font-family:Helvetica
style C fill:#88b2c4,stroke:#333,stroke-width:2px,color:#fff,font-family:Helvetica
style D fill:#cc848a,stroke:#333,stroke-width:2px,color:#000,font-family:Helvetica
style E fill:#cc848a,stroke:#333,stroke-width:2px,color:#000,font-family:Helvetica
style F fill:#9fb56a,stroke:#333,stroke-width:2px,color:#000,font-family:Helvetica
Fork on GitHub
Clone with GitHub Desktop:
pawfinder-service repositoryClone on the command line:
git clone https://github.com/USERNAME/pawfinder-service.git
cd pawfinder-service
Confirm that the clone contains the pawfinder-db-source.json
database file in the api directory.
cd pawfinder-service
npm install
Use GitHub Desktop:
pawfinder-service from the listmaintutorial-testmain branchGitHub Desktop automatically switches to the new tutorial-test branch.
The Current Branch dropdown should display tutorial-test.
Use the command line:
cd pawfinder-service
git checkout -b tutorial-test
# Option 1: use npm (recommended)
# Run from the pawfinder-service root directory
npm start
# Option 2: call json-server directly
# Run from the pawfinder-service api directory
cd api
json-server -w pawfinder-db-source.json
Use cURL
# -X GET is optional, as GET is the default operation
curl -X GET http://localhost:3000/shelters
Use Postman desktop app
+ button to create a new requestGET from the HTTP method drop-down listhttp://localhost:3000/sheltersIf the service is running correctly it retrieves a list of shelters:
[
{
"name": "Dallas Animal Services",
"address": "1818 N Westmoreland Rd, Dallas, TX 75212",
"phone": "+1-214-671-0249",
"email": "info@dallasanimalservices.org",
"hours": "Mon-Sat 11:00-18:00",
"available_pet_count": 22,
"adoption_fee_range": "75-200",
"id": 1
},
{
"name": "Fort Worth Animal Care & Control",
"address": "4900 Martin St, Fort Worth, TX 76119",
"phone": "+1-817-392-1234",
"email": "adopt@fortworthanimalcare.org",
"hours": "Mon-Fri 11:00-18:00, Sat-Sun 12:00-17:00",
"available_pet_count": 18,
"adoption_fee_range": "50-175",
"id": 2
},
...
]
When encountering errors in any of the installation steps, investigate, and correct the error before moving forward. Common situations that cause errors:
npm installIf the service correctly retrieves a list of shelter profiles, move on to the Quickstart Guide.