【发布时间】:2021-02-15 04:45:50
【问题描述】:
与ExpressJS 一样,app.get("/*") 适用于所有路线。
我的代码 -
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get('/*')
def user_lost():
return "Sorry You Are Lost !"
我试过了,但是网页结果显示{"detail":"Not Found"}
我怎样才能在 FastApi 中做到相同?
【问题讨论】:
-
你已经尝试过什么?请参阅How to Ask。
-
我试过了,还是不行。