Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nitedani/fastapi-cls-controller
https://github.com/nitedani/fastapi-cls-controller
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/nitedani/fastapi-cls-controller
- Owner: nitedani
- Created: 2022-08-28T04:18:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-28T04:55:31.000Z (over 2 years ago)
- Last Synced: 2024-10-30T16:13:13.112Z (3 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A class/decorator based router for FastAPI
---```python
# fruit_controller.py
from fastapi_cls_controller import controller, delete, get, post, put, ...@controller(
# Arguments are forwarded to the fastapi APIRouter.
prefix="/fruits",
)
class FruitController:
@post("")
async def create(self, body: CreateFruit):
...@get("/{fruit_id}")
async def get(self, fruit_id: str):
...```
```python
# main.py
app.include_router(FruitController())
```