A complete RESTful API built with Node.js and Express.js for managing a book review system. This project is the final assignment for the Back-End Development module of the IBM Full Stack Software Developer Professional Certificate on Coursera.
This API provides public endpoints to browse a library of books and authenticated endpoints for registered users to manage their book reviews. The server utilizes express-session and jsonwebtoken (JWT) to securely manage authentication and user sessions.
-
Public Users:
- View all books available in the shop.
- Search for books by ISBN.
- Search for books by Author.
- Search for books by Title.
- Read existing book reviews.
- Register as a new user.
-
Authenticated Users:
- Secure Login with JSON Web Tokens (JWT).
- Add a new review to a book.
- Modify a completed review.
- Delete their own review.
- Multiple users can review the same book independently.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Retrieve the entire list of books. |
GET |
/isbn/:isbn |
Retrieve details of a specific book by its ISBN. |
GET |
/author/:author |
Retrieve books written by a specific author. |
GET |
/title/:title |
Retrieve books with a specific title. |
GET |
/review/:isbn |
Retrieve all reviews for a specific book. |
POST |
/register |
Register a new user in the system. |
Requires users to be logged in and possess a valid JWT session token.
| Method | Endpoint | Description |
|---|---|---|
POST |
/customer/login |
Login with username and password to get a token. |
PUT |
/customer/auth/review/:isbn |
Add or update a review for a specific book. |
DELETE |
/customer/auth/review/:isbn |
Delete the logged-in user's review for a book. |
Make sure you have Node.js installed on your machine.
-
Clone the project / Navigate to directory:
cd final_project -
Install all dependencies:
npm install
-
Install Axios (Required for Testing Scripts):
npm install axios
-
Start the Express Server:
npm start
The server will start on
http://localhost:5000
As required by the IBM course rubric, data fetching is demonstrated using Promises and async/await with Axios. The project includes two testing scripts to verify all endpoints are working correctly.
Run the test_general.js script to test fetching books, authors, and titles:
node test_general.jsRun the test_auth.js script to test user registration and login:
node test_auth.jsYou can also test the endpoints manually using Postman.
- Example cURL to get all books:
curl -s http://localhost:5000/
- Backend Framework: Express.js
- Runtime Environment: Node.js
- Authentication: jsonwebtoken (JWT), express-session
- HTTP Client (for testing): Axios
This project is licensed under the MIT License - see the LICENSE file for details.