This commit is contained in:
2025-11-16 14:29:01 +01:00
commit 4dc8435d6f
4 changed files with 83 additions and 0 deletions

26
main.py Normal file
View File

@@ -0,0 +1,26 @@
from fastapi import FastAPI
from contextlib import asynccontextmanager
import database
import models
@asynccontextmanager
async def lifespan(app: FastAPI):
database.init()
yield
database.close()
app = FastAPI(lifespan=lifespan)
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.post("/users")
async def register(user: models.User):
database.register(user)
return user
@app.post("/login")
async def login(user: models.User):
return database.login(user)