Skip to content

allenjose24/expressBookReviews

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Book Review Application - Node.js & Express Final Project

πŸ“– Project Overview

This is a comprehensive backend application for an Online Book Review System built with Node.js and Express.js. The application provides RESTful APIs for managing books, user authentication, and book reviews with support for concurrent user operations.

πŸš€ Features

General User Features

  • βœ… Retrieve list of all available books
  • βœ… Search books by ISBN
  • βœ… Search books by Author
  • βœ… Search books by Title
  • βœ… View book reviews
  • βœ… User registration

Authenticated User Features

  • βœ… User login with JWT authentication
  • βœ… Add book reviews (authenticated users only)
  • βœ… Modify own book reviews
  • βœ… Delete own book reviews
  • βœ… Session-based authentication

Advanced Features

  • βœ… Async/Await implementation for all CRUD operations
  • βœ… Promise-based API calls
  • βœ… Concurrent user support
  • βœ… JWT token-based authentication
  • βœ… Session management

πŸ› οΈ Technology Stack

  • Backend Framework: Express.js
  • Runtime: Node.js
  • Authentication: JWT (JSON Web Tokens) + Express Sessions
  • Async Operations: Promises, Async/Await
  • Testing: Postman

πŸ“ Project Structure

expressBookReviews/
└── final_project/
    β”œβ”€β”€ index.js              # Main server file
    β”œβ”€β”€ package.json          # Dependencies
    β”œβ”€β”€ booksdb.js           # Book database
    └── router/
        β”œβ”€β”€ general.js       # Public routes
        └── auth_users.js    # Authenticated routes

πŸ”§ Installation & Setup

  1. Clone the repository:

    git clone https://github.com/allenjose24/expressBookReviews.git
    cd expressBookReviews/final_project
  2. Install dependencies:

    npm install
  3. Start the server:

    node index.js
  4. Server will run on: http://localhost:5000

πŸ“š API Endpoints

Public Routes (No Authentication Required)

Method Endpoint Description
GET / Get all books
GET /isbn/:isbn Get book by ISBN
GET /author/:author Get books by author
GET /title/:title Get books by title
GET /review/:isbn Get book reviews
POST /register Register new user

Authenticated Routes (Login Required)

Method Endpoint Description
POST /customer/login User login
PUT /customer/auth/review/:isbn?review=<review> Add/modify book review
DELETE /customer/auth/review/:isbn Delete book review

πŸ§ͺ Testing with Postman

1. Register a New User

POST http://localhost:5000/register
Body (JSON):
{
  "username": "testuser",
  "password": "testpass"
}

2. Login

POST http://localhost:5000/customer/login
Body (JSON):
{
  "username": "testuser",
  "password": "testpass"
}

3. Get All Books

GET http://localhost:5000/

4. Search Book by ISBN

GET http://localhost:5000/isbn/1

5. Add a Review (After Login)

PUT http://localhost:5000/customer/auth/review/1?review=This is a great book!

6. Delete a Review (After Login)

DELETE http://localhost:5000/customer/auth/review/1

πŸ“Š Sample Data

The application comes pre-loaded with 10 classic books:

  1. Things Fall Apart - Chinua Achebe
  2. Fairy tales - Hans Christian Andersen
  3. The Divine Comedy - Dante Alighieri
  4. The Epic Of Gilgamesh - Unknown
  5. The Book Of Job - Unknown
  6. One Thousand and One Nights - Unknown
  7. NjΓ‘l's Saga - Unknown
  8. Pride and Prejudice - Jane Austen
  9. Le Père Goriot - Honoré de Balzac
  10. Molloy, Malone Dies, The Unnamable, the trilogy - Samuel Beckett

πŸ” Authentication System

  • JWT Tokens: Used for secure authentication
  • Session Management: Express sessions for maintaining user state
  • Password Protection: Users can only modify/delete their own reviews
  • Access Control: Certain endpoints require authentication

⚑ Async Implementation

All CRUD operations are implemented with:

  • Async/Await functions for better performance
  • Promise-based operations for non-blocking I/O
  • Concurrent user support allowing multiple users simultaneously
  • Timeout simulation to demonstrate async behavior

πŸ“Έ Screenshots

All functionality has been tested and documented with screenshots:

  • 1-getallbooks.png - Get all books
  • 2-gedetailsISBN.png - Get book by ISBN
  • 3-getbooksbyauthor.png - Get books by author
  • 4-getbooksbytitle.png - Get books by title
  • 5-getbookreview.png - Get book reviews
  • 6-register.png - User registration
  • 7-login.png - User login
  • 8-reviewadded.png - Add book review
  • 9-deletereview.png - Delete book review
  • task10.png - Async implementation (Get all books)
  • task11.png - Promise implementation (Get by ISBN)
  • task12.png - Async implementation (Get by author)
  • task13.png - Async implementation (Get by title)

🎯 Project Completion

This project successfully implements all 14 required tasks:

General Users (Tasks 1-5):

  • βœ… Task 1: Get book list
  • βœ… Task 2: Get books by ISBN
  • βœ… Task 3: Get books by Author
  • βœ… Task 4: Get books by Title
  • βœ… Task 5: Get book reviews

Authentication (Tasks 6-7):

  • βœ… Task 6: Register new user
  • βœ… Task 7: User login

Registered Users (Tasks 8-9):

  • βœ… Task 8: Add/modify book review
  • βœ… Task 9: Delete book review

Async Implementation (Tasks 10-13):

  • βœ… Task 10: Get all books (Async/Await)
  • βœ… Task 11: Search by ISBN (Promises)
  • βœ… Task 12: Search by Author (Async/Await)
  • βœ… Task 13: Search by Title (Async/Await)

Submission (Task 14):

  • βœ… Task 14: GitHub repository submission

🀝 Contributing

This project was developed as part of the IBM Full Stack Software Developer course on Coursera. It demonstrates proficiency in:

  • RESTful API development
  • Node.js & Express.js framework
  • JWT authentication & session management
  • Asynchronous JavaScript programming
  • Database operations & CRUD functionality
  • Testing with Postman

πŸ“ License

This project is part of the IBM Developer Skills Network educational content.


Developed by: Allen Jose
Course: Developing Backend Apps with Node.js and Express - IBM Coursera
Project: Final Project - Book Review Application

About

nodejsFinalModule

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%