Upload files to "/"
parent
7f0c0c3539
commit
d46408294c
|
|
@ -0,0 +1,19 @@
|
|||
from fastapi import FastAPI, WebSocket
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
with open("index.html", "r") as file:
|
||||
html = file.read()
|
||||
|
||||
@app.get("/")
|
||||
async def get():
|
||||
return HTMLResponse(html)
|
||||
|
||||
|
||||
@app.websocket("/ws")
|
||||
async def websocket_endpoint(websocket: WebSocket):
|
||||
await websocket.accept()
|
||||
while True:
|
||||
data = await websocket.receive_text()
|
||||
await websocket.send_text(data)
|
||||
Loading…
Reference in New Issue