Init
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
from fastapi import FastAPI, WebSocket
|
||||
|
||||
from app.core.config import get_settings
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
app = FastAPI(
|
||||
title="University Process Hub",
|
||||
root_path=settings.APP_PREFIX,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"status": "ok", "env": settings.APP_ENV}
|
||||
|
||||
|
||||
@app.websocket("/ws/hello/{name}")
|
||||
async def websocket_hello(websocket: WebSocket, name: str):
|
||||
await websocket.accept()
|
||||
await websocket.send_text(f"Hello, {name}!")
|
||||
await websocket.close()
|
||||
Reference in New Issue
Block a user