Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/themusharraf/fastapibooks
A REST API built with Python and FastAPI, integrating with PostgreSQL for CRUD operations (Create, Read, Update, Delete) on books.
https://github.com/themusharraf/fastapibooks
api architecture data-structures database fastapi render server sqlalchemy
Last synced: about 1 month ago
JSON representation
A REST API built with Python and FastAPI, integrating with PostgreSQL for CRUD operations (Create, Read, Update, Delete) on books.
- Host: GitHub
- URL: https://github.com/themusharraf/fastapibooks
- Owner: themusharraf
- Created: 2024-06-14T05:14:22.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-07-06T21:59:23.000Z (6 months ago)
- Last Synced: 2024-07-07T17:00:55.553Z (6 months ago)
- Topics: api, architecture, data-structures, database, fastapi, render, server, sqlalchemy
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BookAPI Project architecture
## Author: Musharraf 👽## BooksAPI endpoints
![image](https://github.com/themusharraf/FastAPIBooks/assets/122869450/1517ab38-808e-4848-b8bb-9cd2667fe1bd)
## BooksAPI ORM
![image](https://github.com/themusharraf/FastAPIBooks/assets/122869450/aae7e4d1-2eb5-4efa-a9f8-74937c6a319d)
## runner
```shell
uvicorn main:app --reload
```## Example Endpoint for test User:
```python
def test_get_user():
requests = client.get("/users/1")
assert requests.status_code == 200
assert type(requests.json()['email']) == str
assert type(requests.json()['is_active']) == bool```
## Example Endpoint for test Books:```python
def test_get_books():
requests = client.get("/books/")
assert requests.status_code == 200
assert type(requests.json()) == list
```
## Example Request for Updating User:
### http```http
PUT /users/1
Content-Type: application/json{
"username": "new_username",
"email": "[email protected]",
"is_active": true,
"password": "new_password"
}
```
## Example Request for Updating Book:
### http```http
PUT /books/1
Content-Type: application/json{
"title": "Updated Title",
"language": "English",
"isbn": "978-3-16-148410-0",
"pages": 250
}
```