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: 2 months 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 (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-23T10:48:22.000Z (10 months ago)
- Last Synced: 2026-03-13T05:52:47.519Z (3 months ago)
- Topics: crud, crud-api, crud-operation, fastapi, python
- Language: Python
- Homepage: https://pypi.org/project/kougen-fastapi-crud/
- Size: 50.8 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
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)
```