Before you start a tutorial
These are the steps you must do before you can run the tutorials for the Book Buddy API.
Expect this preparation to take about 20 minutes to complete.
Preparing for the tutorials
To complete the tutorials in this section, you need the following. You might want to open the links in separate browser tabs before you start installing the software.
- A GitHub account
- A development system running a current version or a long-term support, also known as LTS, version of the Windows, MacOS, or Linux operating system.
- The following software on your development system:
- Git, command line
- GitHub Desktop. This is optional, but recommended.
- A fork of the Book Buddy API repository
- A current or LTS version of
node.js - Version 0.17.4 of json-server
-
A current copy of the database file. You can get this by syncing your fork.
Tip: if you’re using a fork of the repository, create a working branch in which to do your tutorials. Create a new branch for each tutorial to prevent a mistake in one from affecting your work in another.
- The Postman desktop app. Because you run the Book Buddy API on your development system with an
http://localhosthost name, the web-version of Postman can’t perform the exercises.
Test your development system
To test your development system:
- Create and checkout a test branch of your fork of the Book Buddy API repository. Your
GitHub repository workspaceis the directory that contains your fork of thebook-buddy-apirepository.
cd <your GitHub repository workspace>
ls
# (see the book-buddy-api directory in the list)
cd book-buddy-api
git checkout -b tutorial-test
json-server -w book-buddy-api-source.json
If you installed the software correctly, you should see
the service start and display the URL of the service: `http://localhost:3000`.
- Make a test call to the service.
curl http://localhost:3000/books
- If the service is running correctly, you should see a list of books from the service, such as in this example.
[
{
"title": "Pride and Prejudice",
"author": "Jane Austen",
"genre": "Romance",
"readingStatus": "completed",
"id": 1
},
{
"title": "The Hobbit",
"author": "J.R.R. Tolkien",
"genre": "Fantasy",
"readingStatus": "reading",
"id": 2
},
...
]
You should see the list of books. If you receive an error in any step of the procedure, investigate and correct the error before continuing. Some common situations that cause errors include:
- You mistyped a command.
- You aren’t in the correct directory.
- A required software component didn’t install correctly.
- A required software component isn’t up to date.
If you see the list of books from the service, you’re ready to do the Tutorials.