Express Book Reviews API Documentation

This is a RESTful API for a book review application built with Express.js. The API provides endpoints for browsing books, reading reviews, and for authenticated users to add or delete their own reviews.

General User Endpoints

GET /
Get all books available in the shop.
GET /isbn/:isbn
Get book details based on ISBN.
Example: /isbn/1
GET /author/:author
Get books by a specific author.
Example: /author/Jane%20Austen
GET /title/:title
Get books by title.
Example: /title/Things%20Fall%20Apart
GET /review/:isbn
Get reviews for a specific book by ISBN.
Example: /review/1

User Management

POST /register
Register a new user.
Body: { "username": "your_username", "password": "your_password" }
POST /customer/login
Login with registered credentials.
Body: { "username": "your_username", "password": "your_password" }

Authenticated User Endpoints

PUT /customer/auth/review/:isbn
Add or update a review for a book (requires authentication).
Query parameter: review
Example: /customer/auth/review/1?review=Great%20book!
DELETE /customer/auth/review/:isbn
Delete your review for a book (requires authentication).
Example: /customer/auth/review/1

Async/Promise Endpoints

GET /async/books
Get all books using Async/Await.
GET /async/isbn/:isbn
Get book by ISBN using Async/Await.
Example: /async/isbn/1
GET /async/author/:author
Get books by author using Promises.
Example: /async/author/Jane%20Austen
GET /async/title/:title
Get books by title using Promises.
Example: /async/title/Things%20Fall%20Apart

Running the API

This API is built with Node.js and Express. To run it locally:

  1. Clone the repository: git clone https://github.com/Ireneusrdx/expressBookReviews.git
  2. Navigate to the project directory: cd expressBookReviews/final_project
  3. Install dependencies: npm install
  4. Start the server: node index.js
  5. The API will be available at http://localhost:5000