This document provides an overview of the backend API endpoints and functionalities for the bookshelf system project.
Live api link - Link
List the technologies used in the backend, including programming languages, frameworks, libraries, and any external APIs or services.
- Typescript
- Node.js
- Express.js
- MongoDB
- Mongoose
- CORS
- Endpoint:
GET /api/book
- Description: Retrieves a list of all books from the database.
- Response: JSON array containing book objects.
- Endpoint:
GET /api/book/:id
- Description: Retrieves a single book by its unique identifier.
- Request Parameter:
id
(string) - The unique identifier of the book. - Response: JSON object containing the book details.
- Endpoint:
POST /api/book
- Description: Creates a new book and adds it to the database.
- Request Body: JSON object containing the book details.
- Response: JSON object containing the newly created book details.
- Endpoint:
PATCH /api/book/:id
- Description: Updates the details of a specific book.
- Request Parameter:
id
(string) - The unique identifier of the book. - Request Body: JSON object containing the updated book details.
- Response: JSON object containing the updated book details.
- Endpoint:
DELETE /api/book/:id
- Description: Deletes a specific book from the database.
- Request Parameter:
id
(string) - The unique identifier of the book. - Response: JSON object confirming the deletion of the book.
- Endpoint:
POST /api/book/:id/review
- Description: Adds a review for a specific book.
- Request Parameter:
id
(string) - The unique identifier of the book. - Request Body: JSON object containing the review details.
- Response: JSON object confirming the addition of the review.
- Endpoint:
POST /api/user/register
- Description: Creates a new user account.
- Request Body: JSON object containing the user registration details.
- Response: JSON object confirming the successful user registration.
- Endpoint:
POST /api/user/login
- Description: Authenticates the user and generates an access token.
- Request Body: JSON object containing the user login credentials.
- Response: JSON object containing the access token.
- Endpoint:
POST /api/user/logout
- Description: Invalidates the user's access token, logging them out.
- Response: JSON object confirming the successful user logout.
This project is dependent on/interconnected with another frontend project. Frontend project and documentation link is here.
-
Clone the repository:
git clone https://github.com/zhSHUVO/bookshelf-server.git
-
Navigate to the project directory:
cd bookshelf-server
-
Install dependencies:
npm install
-
Setup .env file. Example:
PORT=--------- MONGODB_DATABASE_URL=--------- MONGODB_COMPASS_URL=---------
-
Start the development server:
npm run dev
-
Development server will run on
http://localhost:5000
This project is licensed under the MIT License. See the LICENSE file for details.
If you'd like to contribute to this project, please follow the Contributing Guidelines.
If you encounter any issues or have questions or suggestions, please open an issue.