Spaces:
Sleeping
Sleeping
| # 从 fastapi 模块导入 FastAPI 类 | |
| from fastapi import FastAPI | |
| # 创建一个 FastAPI 应用实例 | |
| app = FastAPI() | |
| # 使用装饰器定义一个路由,这里是根路由 "/",使用 HTTP GET 方法 | |
| # 定义一个函数来处理对根路由的请求 | |
| def read_root(): | |
| # 返回一个简单的 JSON 响应 | |
| return {"Hello": "World!"} |