23 lines
668 B
Python
23 lines
668 B
Python
from fastapi import FastAPI
|
|
from fastapi.responses import HTMLResponse
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
app = FastAPI()
|
|
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
@app.get("/", response_class=HTMLResponse)
|
|
async def root():
|
|
with open("static/index.html") as f:
|
|
return f.read()
|
|
|
|
@app.get("/get_level/{level}")
|
|
async def get_level(level: int):
|
|
# For now, return a static range; adjust based on your game logic
|
|
return {"multiplier_range": [1, 10]}
|
|
|
|
@app.post("/submit_score/")
|
|
async def submit_score(data: dict):
|
|
# For now, just return success; add database logic if needed
|
|
return {"status": "success"}
|