[FastAPI-03]动态静态路由顺序的问题-静态路由先执行
from fastapi import FastAPI
app= FastAPI()
# 静态路由优先级高于动态路由
# 必须写在动态路由的前面
@app.get("/books/most_populer")
def books_most_populer():
return {"This Book is:":"Python3"}
@app.get("/books/{number}")
def books(number:int):
return {"msg":{"BookNumber":number,"Price":20}}