Python极客
安装FastAPI#下载fastapi模块pipinstallfastapi-ihttps://pypi.tuna.tsinghua.edu.cn/simple#安装uvicorn用作服务器pipinstalluvicorn-ihttps://pypi.tuna.tsinghua.edu.cn/simpleget请求测试importuvicornfromfastapiimportFastAPIapp=FastAPI()@app.get("/")asyncdefget_demo():return{"message":"HelloWorld"}if__name__=='__main__':uvicorn.run(app=app,host="127.0.0.1",port=5000,debug=True)查看Api文档所有的Api接口文档,都会自动生成,不需要额外的Api测试软件http://127.0.0.1:5000/docs