FastAPI
更新于 2026-08-30 00:08:41
FastAPI
FastAPI 是一个现代、快速(高性能)的 Python Web 框架,基于标准 Python 类型提示构建。
特点
- 快速:与 NodeJS 和 Go 相当的高性能
- 快速编码:功能开发速度提升约 200%-300%
- 更少的 Bug:减少约 40% 的人为错误
- 智能:自动补全与文档
- 简单:设计易于使用和学习
- 标准化:基于 OpenAPI 和 JSON Schema
快速上手
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}