Skip to content
Permalink
Browse files
starting the API
Added detailed instructions on cloning and running the bookshop API.
  • Loading branch information
aa7401 committed Jul 2, 2017
1 parent 706d451 commit 6ffdad729c5194a3f4ee9112af92740088cbd919
Showing 1 changed file with 13 additions and 4 deletions.
@@ -3,7 +3,16 @@

The aim of this book is to teach you the principles and practical skills to build useful secure APIs but before we dive into the technical aspects we should take a step back and understand their purpose and how they should work. This chapter is slightly different from the others insofar as you will learn, not how to build an API but _why_ these are written and how they are used. The understanding you gain from this chapter will then help you design and build your own.

## 1 Working with the HTTP Protocol
## 1 Configuring the Sample API

As you explore the features of a RESTful API you will be interacting with the **Bookshop API** which can be found at https://github.coventry.ac.uk/304CEM-1718SEPJAN/bookshop and will need to be downloaded and run on your computer. The following instructions show how to do this on an Ubuntu computer, you will need to adapt these if you are using a different operating system. It is assumed you have already installed a running version of MongoDB. If you have not yet done this, refer to chapter 7 (Data Persistence).

1. Start by cloning the repository into you Documents directory `git clone https://github.coventry.ac.uk/304CEM-1718SEPJAN/bookshop ~/Documents/bookshop`. This will create a `bookshop/` directory which you will need to navigate to using your terminal.
2. The API can run in one of two modes, `development` or `production`, and this is determined by the `NODE_ENV` environment variable. Set this to `development`.
3. Now you can start the API by running the `index.js` script.


## 2 Working with the HTTP Protocol

HTTP is an application protocol designed to support distributed hypermedia systems and is used when developing APIs so it is important that you have a good understanding of this.

@@ -13,16 +22,16 @@ HTTP Headers allow the client to pass additional information with the request an

User agent

### 1.1 The Request
### 2.1 The Request

Request headers

### 1.2 The Response
### 2.2 The Response

Response headers


### 1.3 The User Agent
### 2.3 The User Agent

xxx

0 comments on commit 6ffdad7

Please sign in to comment.