Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-10-07 23:52:55 +02:00
commit a4fd5fd2d9
61 changed files with 18951 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# backend/main.py
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from livekit import api
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # permite desde cualquier origen
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/token")
def get_token(room: str, user: str):
access = api.AccessToken("devkey", "secret")
grants = api.VideoGrants(
room_join=True,
room=room,
can_publish=True,
can_subscribe=True,
)
access.with_identity(user).with_grants(grants)
token = access.to_jwt()
return {"token": token}