from fastapi import FastAPI
import uvicorn
app = FastAPI()
# 默认接口文档 http://127.0.0.1:8000/docs
@app.get("/")
def index():
'''这是首页'''
return "this is a fast api"
@app.get("/user")
def user():
'''这是获取所有用户'''
return {"msg: get all users, code:200"}
@app.get("/projects")
def projects():
return ["project1","project2"]
if __name__ == "__main__":
uvicorn.run(app)