小编Aka*_*aik的帖子

如何设置“/*”路径来捕获FastAPI中的所有路由?

与 中一样ExpressJSapp.get("/*")适用于所有路线。

我的代码 -

from typing import Optional
from fastapi import FastAPI

app = FastAPI()


@app.get('/*')
def user_lost():
    return "Sorry You Are Lost !"
Run Code Online (Sandbox Code Playgroud)

我尝试过,但网页结果显示{"detail":"Not Found"}
How can I do the same in FastApi?

python fastapi

3
推荐指数
1
解决办法
4143
查看次数

标签 统计

fastapi ×1

python ×1