To set up and run the application locally, follow these steps:
-
Clone this repository to your local machine.
git clone <repository-url>
-
Navigate to the project directory.
-
Install the required dependencies.
npm install
-
Set up a MongoDB database either locally or using a cloud solution like MongoDB Atlas. Update the MongoDB connection URI in the db.js file.
-
Run the application.
npm start
This is a RESTful API for managing books. It allows users to perform CRUD (Create, Read, Update, Delete) operations on book data. The API is built using Node.js, Express.js, and MongoDB(moongoose).
-
Add a New Book:
- Endpoint:
POST /books - Usage:
- Send a POST request to
/bookswith a JSON body containing book details (title, author, summary) to create a new book.
- Send a POST request to
- Endpoint:
-
View a List of All Books:
- Endpoint:
GET /books - Usage:
- Send a GET request to
/booksto retrieve a list of all books in the database.
- Send a GET request to
- Endpoint:
-
View Details of a Specific Book by its ID:
- Endpoint:
GET /books/:id - Usage:
- Send a GET request to
/books/:idwith the book's ID to retrieve the details of a specific book.
- Send a GET request to
- Endpoint:
-
Update a Book's Details:
- Endpoint:
PUT /books/:id - Usage:
- Send a PUT request to
/books/:idwith the book's ID and a JSON body containing the updated book details (title, author, summary) to update a specific book.
- Send a PUT request to
- Endpoint:
-
Delete a Book:
- Endpoint:
DELETE /books/:id - Usage:
- Send a DELETE request to
/books/:idwith the book's ID to delete a specific book.
- Send a DELETE request to
- Endpoint: