chore: naming

parent ebe04bfa
from fastapi import FastAPI, APIRouter
from starlette.websockets import WebSocket
from server.model.data import Game, Player
app = FastAPI()
router = APIRouter()
game = Game()
@router.get("/")
async def hello_world():
return "Hello, gentle[wo]man"
@router.post("/join")
async def join(player_name: str):
game.players.append(Player(player_name))
@router.post("/ready")
async def ready():
pass
@router.post("/play")
async def play():
pass
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
while True:
data = await websocket.receive_text()
await websocket.send_text(f"Message text was: {data}")
app.include_router(router)
if __name__ == '__main__':
import uvicorn
uvicorn.run("app:app", host="0.0.0.0", port=9042, reload=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment