This commit is contained in:
Waylon Walker 2023-06-14 13:43:06 -05:00
parent 892a3c9a8a
commit 3f28a10b16
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
5 changed files with 98 additions and 111 deletions

View file

@ -1,25 +1,38 @@
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from learn_sql_model.api.hero import hero_router
from learn_sql_model.api.user import user_router
from learn_sql_model.api.websocket import web_socket_router
# from fastapi_socketio import SocketManager
app = FastAPI()
# socket_manager = SocketManager(app=app)
app.include_router(hero_router)
app.include_router(user_router)
app.include_router(web_socket_router)
# @app.sio.on("join")
# def handle_join(sid, *args, **kwargs):
# app.sio.emit("lobby", "User joined")
html = """
<!DOCTYPE html>
<html>
<head>
<title>Learn SQL Model</title>
</head>
<body>
<h1>Learn SQL Model</h1>
<p>Join the game with the following command.
</p>
<p>
pipx run --spec git+https://github.com/WaylonWalker/learn-sql-model lsm game run
</p>
<p>
You can watch player data at <a href='/watch'>watch</a>
</p>
</body>
</html>
"""
# @app.sio.on("leave")
# def handle_leave(sid, *args, **kwargs):
# sm.emit("lobby", "User left")
@app.get("/")
async def get():
return HTMLResponse(html)