1 Star 0 Fork 0

OpenMINDS/Building-Python-Microservices-with-FastAPI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 883 Bytes
一键复制 编辑 原始数据 按行查看 历史
OpenMINDS 提交于 1年前 . 'correct'
from fastapi import FastAPI, Depends
from controllers import reservations, admin, assignments
from configuration.config import StudentSettings, ServerSettings
app = FastAPI()
app.include_router(reservations.router, prefix="/ch04/student")
app.include_router(admin.router, prefix="/ch04/student")
app.include_router(assignments.router, prefix="/ch04/student")
def build_config():
return StudentSettings()
def fetch_config():
return ServerSettings()
@app.get('/index')
def index_student(config: StudentSettings = Depends(build_config),
fconfig: ServerSettings = Depends(fetch_config)):
return {
'project_name': config.application,
'webmaster': config.webmaster,
'created': config.created,
'development_server': fconfig.development_server,
'dev_port': fconfig.dev_port
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openminds/Building-Python-Microservices-with-FastAPI.git
git@gitee.com:openminds/Building-Python-Microservices-with-FastAPI.git
openminds
Building-Python-Microservices-with-FastAPI
Building-Python-Microservices-with-FastAPI
main

搜索帮助