The Book Management project is a server-side application designed to streamline the process of managing books and their associated information. The project provides a user-friendly interface that allows users to register, login, and perform various operations related to books. Users can create new books, update existing book details, retrieve book information, and delete books if necessary. Additionally, the application allows users to write reviews for books and view reviews submitted by other users. The project ensures data security by implementing user authentication and authorization mechanisms. With the Book Management project, users can efficiently organize, track, and review books, making it a valuable tool for book enthusiasts, libraries, and bookstores.
- Node.js
- Express.js
- MongoDB
- JavaScript
- JSON Web Token
- Validator
https://book-management-yqjo.onrender.com
The following models are used in this project:
-
User
title
: The user's title (Mr, Mrs, Miss)name
: The user's namephone
: The user's phone numberemail
: The user's email addresspassword
: The user's passwordaddress
: The user's addresscreatedAt
: The date and time the user was createdupdatedAt
: The date and time the user was last updated
-
Books
title
: The title of the bookexcerpt
: A short summary of the bookuserId
: The ID of the user who created the bookISBN
: The ISBN of the bookcategory
: The category of the booksubcategory
: The subcategory of the bookreviews
: The number of reviews for the bookdeletedAt
: The date and time the book was deletedisDeleted
: Whether the book is deletedreleasedAt
: The date and time the book was releasedcreatedAt
: The date and time the book was createdupdatedAt
: The date and time the book was last updated
-
Review
bookId
: The ID of the book that the review is forreviewedBy
: The name of the person who wrote the reviewreviewedAt
: The date and time the review was writtenrating
: The rating of the book (1-5 stars)review
: The text of the reviewisDeleted
: Whether the review is deleted
The following APIs are available for users:
-
POST /register
- Creates a new user.
- Returns the newly created user.
-
POST /login
- Logs in a user.
- Returns a JWT token that can be used to authenticate future requests.
The following APIs are available for books:
-
POST /books
- Creates a new book.
- Returns the newly created book.
-
GET /books
- Returns a list of all books.
-
GET /books/:bookId
- Returns a specific book.
-
PUT /books/:bookId
- Updates a specific book.
-
DELETE /books/:bookId
- Deletes a specific book.
-
POST /books/:bookId/review
- Creates a new review for a book.
- Returns the book with the review included.
-
PUT /books/:bookId/review/:reviewId
- Updates a review for a book.
- Returns the book with the review included.
-
DELETE /books/:bookId/review/:reviewId
- Deletes a review for a book.
- Returns the book with the review excluded.
All book APIs require authentication. The JWT token that is returned from the POST /login
endpoint can be used to authenticate future requests.
Only the owner of a book can create, edit, or delete the book. If a user attempts to perform an unauthorized action, they will receive an error message.
The following error responses are returned by the APIs:
- 400 Bad Request
- The request was malformed.
- 401 Unauthorized
- The user is not authorized to perform the requested action.
- 404 Not Found
- The resource was not found.
- 500 Internal Server Error
- An unexpected error occurred.
The following successful responses are returned by the APIs:
- 200 OK
- The request was successful.
- 201 Created
- The resource was created successfully.
I hope this documentation is helpful. Please let me know if you have any questions.