Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kougen/fastapi-crud
CRUD operation bootstrapping for FastAPI clients
https://github.com/kougen/fastapi-crud
crud crud-api crud-operation fastapi python
Last synced: 4 days ago
JSON representation
CRUD operation bootstrapping for FastAPI clients
- Host: GitHub
- URL: https://github.com/kougen/fastapi-crud
- Owner: kougen
- Created: 2024-03-19T11:15:09.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T13:39:14.000Z (9 months ago)
- Last Synced: 2024-12-15T15:47:24.554Z (19 days ago)
- Topics: crud, crud-api, crud-operation, fastapi, python
- Language: Python
- Homepage: https://pypi.org/project/kougen-fastapi-crud/
- Size: 49.8 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI CRUD with dynamic routers
## Introduction
This is a simple CRUD application using FastAPI. The application uses dynamic routers to create routes for each model in the database.
## Features
- Create, Read, Update, Delete operations for each model
- Dynamic routers for each model
- Custom routes for each model## Requirements
- Python 3.6+
- FastAPI
- [pyrepositories](https://pypi.org/project/pyrepositories/)## How to run
First, install the dependencies:
```bash
pip install -r requirements.txt
app = FastAPI()
ds = DataSource(id_type=IdTypes.UUID)
api = CRUDApi(ds, app)
# Registering a router will only setup the route without including it to the app, hence you can add custom endpoints to the router
router = api.register_router("event" , Event).get_base()# You can add custom routes to the router
@router.get("/test", tags=["event"])
def test():
return "test"# You should call this function after all routes are defined to make sure the routes are registered
api.publish()if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=1112)
```