RESTful API backend for the IBM/Coursera Developing Back-End Apps with Node.js and Express final project. Supports book discovery, review retrieval, user registration, session + JWT authentication, and protected review management.
- Book APIs (all books, ISBN, author, title, reviews)
- User registration and login
- Session authentication (
express-session) - JWT authentication (
jsonwebtoken) - Protected add, modify, and delete review routes
- Async operations with Axios, Promises, and async/await
- Non-blocking Express handlers for concurrent access
- Postman collection included
- Node.js
- Express.js
- Express Session
- JSON Web Tokens (JWT)
- Axios
- REST API architecture
final_project/
├── index.js
├── booksdb.js
├── package.json
├── README.md
├── CURL_COMMANDS.md
├── Online-Book-Review.postman_collection.json
├── Online-Book-Review.postman_environment.json
└── router/
├── general.js
└── auth_users.js
cd final_project
npm install
npm startServer runs at: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| GET | /books |
Get all books |
| GET | /books/isbn/:isbn |
Get book by ISBN |
| GET | /books/author/:author |
Search books by author (case-insensitive, partial) |
| GET | /books/title/:title |
Search books by title (case-insensitive, partial) |
| GET | /books/review/:isbn |
Get reviews for a book |
| Method | Endpoint | Implementation |
|---|---|---|
| GET | /books/async/all |
getAllBooksAsync() — async/await |
| GET | /books/async/isbn/:isbn |
getBookByISBNPromise() — Promises |
| GET | /books/async/author/:author |
getBooksByAuthorAsync() — async/await |
| GET | /books/async/title/:title |
getBooksByTitleAsync() — async/await |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /customer/register |
No | Register new user |
| POST | /customer/login |
No | Login (session + JWT token) |
| PUT | /customer/auth/review/:isbn |
Yes | Add or modify own review |
| DELETE | /customer/auth/review/:isbn |
Yes | Delete own review |
Protected routes require an active session created via login. JWT is stored in:
req.session.authorization = {
accessToken: '...',
username: 'john'
}Middleware verifyToken validates the JWT and returns 401 with { "message": "Unauthorized" } when invalid.
See CURL_COMMANDS.md for full commands and expected outputs.
Quick examples:
curl http://localhost:5000/books
curl http://localhost:5000/books/isbn/1
curl http://localhost:5000/books/author/Chinua%20Achebe
curl http://localhost:5000/books/title/Fall
curl http://localhost:5000/books/review/1- Import
Online-Book-Review.postman_collection.json - Import
Online-Book-Review.postman_environment.json - Run Register then Login (cookies stored automatically)
- Run review endpoints
index.jswith Express, session, JWT middlewarerouter/general.js— book routes + async Axios functionsrouter/auth_users.js— register, login, review CRUDbooksdb.js— in-memory book database- Session + JWT authentication
verifyTokenmiddleware- Postman collection (10 requests)
- cURL documentation
- README with API docs
Apache-2.0 (IBM Coursera educational project)