kilogramm/backend/app/api.py

17 lines
444 B
Python

from fastapi import FastAPI, Depends
from models import User
from auth import get_user_info
import uvicorn
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/secure")
async def root(user: User = Depends(get_user_info)):
return {"message": f"Hello {user.username} you have the following service: {user.realm_roles}"}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=9000)