-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddaa0d8
commit bb19115
Showing
9 changed files
with
821 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
# TheBookDB | ||
|
||
TheBookDB is a powerful API built using C++ and the Drogon framework. It provides information about over 11,000 books, sourced from a Kaggle CSV file. | ||
|
||
## Features | ||
|
||
- Retrieve book information | ||
- Filter books by various criteria | ||
- Add new books to the database | ||
- Update existing book information | ||
- Delete books from the database | ||
|
||
## API Endpoints | ||
|
||
- `GET /books`: Retrieve a list of books | ||
- `GET /books/filter`: Filter books based on specific criteria | ||
- `POST /books`: Add a new book | ||
- `PATCH /books/{bookID}`: Update an existing book | ||
- `DELETE /books/{bookID}`: Delete a book | ||
- `PUT /books/{bookID}`: Update or add a book | ||
|
||
## Technology Stack | ||
|
||
- C++ | ||
- Drogon framework | ||
- JsonCpp | ||
- Linux (Ubuntu) | ||
|
||
## Installation | ||
|
||
Thank you for providing the additional dependency information. I'll update the README to include these dependencies. Here's the revised Installation section: | ||
|
||
### Prerequisites | ||
|
||
Ensure you have the following dependencies installed on your Ubuntu system: | ||
|
||
1. Environment setup: | ||
|
||
``` | ||
sudo apt install git gcc g++ cmake | ||
``` | ||
|
||
2. JsonCpp: | ||
|
||
``` | ||
sudo apt install libjsoncpp-dev | ||
``` | ||
|
||
3. UUID: | ||
|
||
``` | ||
sudo apt install uuid-dev | ||
``` | ||
|
||
4. zlib: | ||
|
||
``` | ||
sudo apt install zlib1g-dev | ||
``` | ||
|
||
5. OpenSSL (Optional, for HTTPS support): | ||
|
||
``` | ||
sudo apt install openssl libssl-dev | ||
``` | ||
|
||
### Building the Project | ||
|
||
1. Clone the repository: | ||
|
||
``` | ||
git clone https://github.com/yourusername/TheBookDB.git | ||
``` | ||
|
||
2. Navigate to the project directory: | ||
|
||
``` | ||
cd TheBookDB | ||
``` | ||
|
||
3. Create a build directory and navigate to it: | ||
|
||
``` | ||
mkdir build && cd build | ||
``` | ||
|
||
4. Generate the build files: | ||
|
||
``` | ||
cmake .. | ||
``` | ||
|
||
5. Build the project: | ||
|
||
``` | ||
make | ||
``` | ||
|
||
6. Run the server: | ||
|
||
``` | ||
./MyDrogonAPI | ||
``` | ||
|
||
The server should now be running and ready to accept requests. | ||
|
||
## Usage | ||
|
||
Once the server is running, you can make HTTP requests to the API endpoints. Here are some examples: | ||
|
||
- Get all books: | ||
|
||
``` | ||
GET http://localhost:8080/books | ||
``` | ||
|
||
- Filter books: | ||
|
||
``` | ||
GET http://localhost:8080/books/filter?startDate=01/01/2000&endDate=12/31/2020 | ||
``` | ||
|
||
- Add a new book: | ||
|
||
``` | ||
POST http://localhost:8080/books | ||
Content-Type: application/json | ||
{ | ||
"title": "New Book", | ||
"authors": "John Doe", | ||
"publicationDate": "05/15/2023" | ||
} | ||
``` | ||
|
||
- Update a new existing (Patch): | ||
|
||
``` | ||
Patch http://localhost:8080/books/{bookID} | ||
Content-Type: application/json | ||
{ | ||
"title": "New Book title", | ||
"authors": "John Doe", | ||
"publicationDate": "05/15/2023" | ||
} | ||
``` | ||
|
||
- Add or update a book (PUT): | ||
|
||
``` | ||
PUT http://localhost:8080/books/{bookID} | ||
Content-Type: application/json | ||
{ | ||
"title": "Edited or Added Title", | ||
"authors": "John Doe", | ||
"publicationDate": "05/15/2023" | ||
} | ||
``` | ||
|
||
- Delete a book: | ||
|
||
``` | ||
DELETE http://localhost:8080/books/{bookID} | ||
``` | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please feel free to submit a Pull Request. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,173 @@ | |
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"> | ||
<link rel="stylesheet" href="styles.css"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>HAHAH</h1> | ||
<nav> | ||
<div class="logo"> | ||
<i class="bi bi-book"></i> | ||
<span>TheBookDB</span> | ||
</div> | ||
<a href="https://github.com/adhikareeprayush/API/" class="contribute"> | ||
<i class="bi bi-github"></i> | ||
</a> | ||
</nav> | ||
<div class="main"> | ||
<div class="about"> | ||
<div class="header"> | ||
<h1>Introduction</h1> | ||
<p> | ||
TheBookDB is a RESTful API that provides information about various books. It provides information about the title, authors, average rating, number of pages, publication date, ISBN, ISBN13, language code, publisher, ratings count, and text reviews count of the books. The API also allows users to add, update, and delete books. | ||
</p> | ||
</div> | ||
</div> | ||
<div class="manual"> | ||
<div class="get-req"> | ||
<div class="header"> | ||
<h1>Get Request</h1> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">List all the Books.</div> | ||
<div class="code"> | ||
/api/books | ||
</div> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">List a specific Book.</div> | ||
<div class="code"> | ||
/api/books?bookID={bookID} | ||
</div> | ||
<div class="note"> | ||
<p>You can use title, authors, avgRating, numPages, publicationDate, isbn, isbn13, languageCode along with bookID. </p> | ||
</div> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">List and sort books according to publicationDate.</div> | ||
<div class="code"> | ||
/api/books?startDate={startDate}&endDate={endDate}&sortOrder={sortOrder} | ||
</div> | ||
<div class="note"> | ||
<p>sortOrder can be either ASC or DSC.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="post-req"> | ||
<div class="header"> | ||
<h1>Post Request</h1> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">Add a new Book.</div> | ||
<div class="code"> | ||
/api/books | ||
</div> | ||
<div class="note"> | ||
<p>Use the following JSON format to add a new book.</p> | ||
<pre> | ||
{ | ||
"authors": "Lynsay Sands", | ||
"avgRating": "3.91", | ||
"bookID": "38568", | ||
"isbn": "0060773758", | ||
"isbn13": "9780060773755", | ||
"languageCode": "eng", | ||
"numPages": "360", | ||
"publicationDate": "3/31/2020", | ||
"publisher": "Avon", | ||
"ratingsCount": "35275", | ||
"textReviewsCount": "1370", | ||
"title": "A Quick Bite (Argeneau #1)" | ||
} | ||
</pre> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="put-req"> | ||
<div class="header"> | ||
<h1>Put Request</h1> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">Update a Book.</div> | ||
<div class="code"> | ||
/api/books/{bookID} | ||
</div> | ||
<div class="note"> | ||
<p>Use the following JSON format to update a book.</p> | ||
<pre> | ||
{ | ||
"authors": "Lynsay Sands", | ||
"avgRating": "3.91", | ||
"bookID": "38568", | ||
"isbn": "0060773758", | ||
"isbn13": "9780060773755", | ||
"languageCode": "eng", | ||
"numPages": "360", | ||
"publicationDate": "3/31/2020", | ||
"publisher": "Avon", | ||
"ratingsCount": "35275", | ||
"textReviewsCount": "1370", | ||
"title": "A Quick Bite (Argeneau #1)" | ||
} | ||
</pre> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="patch-req"> | ||
<div class="header"> | ||
<h1>Patch Request</h1> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">Update a specific field of a Book.</div> | ||
<div class="code"> | ||
/api/books/{bookID} | ||
</div> | ||
<div class="note"> | ||
<p>Use the following JSON format to update a specific field of a book.</p> | ||
<pre> | ||
{ | ||
"authors": "Lynsay Sands", | ||
"avgRating": "3.91", | ||
"bookID": "38568", | ||
"isbn": "0060773758", | ||
"isbn13": "9780060773755", | ||
"languageCode": "eng", | ||
"numPages": "360", | ||
"publicationDate": "3/31/2020", | ||
"publisher": "Avon", | ||
"ratingsCount": "35275", | ||
"textReviewsCount": "1370", | ||
"title": "A Quick Bite (Argeneau #1)" | ||
} | ||
</pre> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="delete-req"> | ||
<div class="header"> | ||
<h1>Delete Request</h1> | ||
</div> | ||
<div class="call"> | ||
<div class="purpose">Delete a Book.</div> | ||
<div class="code"> | ||
/api/books/{bookID} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer> | ||
<p>@2024 TheBookDB</p> | ||
<div class="contributors"> | ||
<a href="https://github.com/pratyoos" class="member">Pratyoos Panta</a> | ||
<a href="https://github.com/rtjsh" class="member">Rajesh Thapa</a> | ||
<a href="https://github.com/prachitvuzel" class="member">Prachit Bhujel</a> | ||
<a href="https://github.com/adhikareeprayush/" class="member">Prayush Adhikari</a> | ||
<a href="#" class="member">Sandesh Pantha</a> | ||
|
||
</div> | ||
</footer> | ||
</body> | ||
</html> |
Oops, something went wrong.