awtkns/fastapi-crudrouter
소개
모델에 대한 CRUD 라우트를 자동으로 생성하는 동적 FastAPI 라우터
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- -1
- in 1 month
- -1
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
⚡ Create CRUD routes with lighting speed ⚡
A dynamic FastAPI router that automatically creates CRUD routes for your models
Documentation: https://fastapi-crudrouter.awtkns.com
Source Code: https://github.com/awtkns/fastapi-crudrouter
Tired of rewriting generic CRUD routes? Need to rapidly prototype a feature for a presentation or a hackathon? Thankfully, fastapi-crudrouter has your back. As an extension to the APIRouter included with FastAPI, the FastAPI CRUDRouter will automatically generate and document your CRUD routes for you, all you have to do is pass your model and maybe your database connection.
FastAPI-CRUDRouter is lighting fast, well tested, and production ready.
Installation
pip install fastapi-crudrouter
Basic Usage
Below is a simple example of what the CRUDRouter can do. In just ten lines of code, you can generate all the crud routes you need for any model. A full list of the routes generated can be found here.
from pydantic import BaseModel
from fastapi import FastAPI
from fastapi_crudrouter import MemoryCRUDRouter as CRUDRouter
class Potato(BaseModel):
id: int
color: str
mass: float
app = FastAPI()
app.include_router(CRUDRouter(schema=Potato))
Advanced Usage
fastapi-crudrouter provides a number of features that allow you to get the most out of your automatically generated CRUD routes. Listed below are some highlights.
- Automatic Pagination (docs)
- Ability to Provide Custom Create and Update Schemas (docs)
- Dynamic Generation of Create and Update Schemas (docs)
- Ability to Add, Customize, or Disable Specific Routes (docs)
- Native Support for FastAPI Dependency Injection (docs)
Supported Backends / ORMs
fastapi-crudrouter currently supports a number of backends / ORMs. Listed below are the backends currently supported. This list will likely grow in future releases.
- In Memory (docs)
- SQLAlchemy (docs)
- Databases (async) (docs)
- Gino (async) (docs)
- Ormar (async) (docs)
- Tortoise ORM (async) (docs)
OpenAPI Support
By default, all routes generated by the CRUDRouter will be documented according to OpenAPI spec.
Below are the default routes created by the CRUDRouter shown in the generated OpenAPI documentation.

The CRUDRouter is able to dynamically generate detailed documentation based on the models given to it.

관련 프로젝트 살펴보기
불러오는 중…