This server was created to accompany the user interface of 'Book Club', a frontend Mod 3 project at the Turing School of Software and Design. We used the NYT Best Selling Books API to populate a PostgreSQL database which this API querys using knex. This server was written in JavaScript using Express and Node.
- Clone down this repo to your local machine:
[email protected]:cagallo/book-club-api.git
- Change into the new directory:
cd book-club-api
- Install the dependencies:
npm install
- To fire up the server, run:
node server.js
ornodemon server.js
(if you have nodemon installed)
- In the browser or postman, use the following endpoints with the base URL: http://localhost:3000/ to retrieve, post, or delete data.
- You can also use the following endpoints(besides books, takes you there automatically) on the deployed Heroku API linked above.
Description | URL | Method | Required Properties for Request | Sample Sucessful Response |
---|---|---|---|---|
Get All Books | http://localhost:3001/api/v1/books |
GET | none | array containing all book objects |
Get Single Book | http://localhost:3001/api/v1/books/:isbn where isbn will be the isbn number of single book |
GET | none | array containing an object of single book info |
Get All Favorites | http://localhost:3001/api/v1/favorites |
GET | none | array container all favorite book objects |
Add New Favorite | http://localhost:3001/api/v1/favorites |
POST | { "isbn": "9781250278210", "title": "ABANDONED IN DEATH", "description": "...", "amazon_link": "https://www.amazon.com/dp/125027821X?tag=NYTBSREV-20", "book_image": "https://storage.googleapis.com/du-prd/books/images/9781250278210.jpg", "author": "J.D. Robb"} |
{ id: <id> in favorites table} |
Delete Single Favorited Book | http://localhost:3001/api/v1/favorites/:isbn where isbn will be the isbn number of single book |
DELETE | none | { message: Book with isbn#<isbn> has been removed from favorites } |
Edit Favorited Status | http://localhost:3001/api/v1/books/:isbn |
PATCH | {"isFavorited":"false" OR "true"} |
{ "message": "Book with isbn#<isbn> isFavorited: "false" OR "true" } |
- Express
- PostgreSQL
- Knex.js
- JavaScript
- Node
- Node-Fetch
- PgAdmin4
- Heroku
- Postman
-
Project Manager: Robbie Jaeger