MySafeCode commited on
Commit
1124fbf
·
verified ·
1 Parent(s): b12a44c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from fastapi import FastAPI, Request
 
2
  from pydantic import BaseModel
3
  from collections import deque
4
  from datetime import datetime, timedelta
@@ -34,9 +35,20 @@ def log_message(msg: dict, ip: str):
34
 
35
  # ---------- API Endpoints ----------
36
 
37
- @app.get("/")
38
- def root():
39
- return {"message": "Hello HF!"}
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  @app.post("/write")
42
  async def write_message(msg: Message, request: Request):
 
1
  from fastapi import FastAPI, Request
2
+ from fastapi.responses import HTMLResponse
3
  from pydantic import BaseModel
4
  from collections import deque
5
  from datetime import datetime, timedelta
 
35
 
36
  # ---------- API Endpoints ----------
37
 
38
+
39
+
40
+ @app.get("/", response_class=HTMLResponse)
41
+ async def root():
42
+ return """
43
+ <html>
44
+ <head><title>Chat API</title></head>
45
+ <body>
46
+ <h1>Hello HF!</h1>
47
+ <p>See the <a href="/docs">Swagger docs</a>.</p>
48
+ </body>
49
+ </html>
50
+ """
51
+
52
 
53
  @app.post("/write")
54
  async def write_message(msg: Message, request: Request):