from fastapi import FastAPI
import uvicorn
app = FastAPI()
# 访问方式:http://127.0.0.1:8000/user?id=888
@app.get("/user")
def user(id): # id 为接收的参数
return {"id": id}
if __name__ == '__main__':
uvicorn.run(app)
from fastapi import FastAPI
import uvicorn
app = FastAPI()
# 访问方式:http://127.0.0.1:8000/user?id=888
@app.get("/user")
def user(id): # id 为接收的参数
return {"id": id}
if __name__ == '__main__':
uvicorn.run(app)