update root page

This commit is contained in:
brb
2023-07-06 13:20:24 +02:00
parent 02ec54fd16
commit ed05a8eca5
+15 -3
View File
@@ -1,5 +1,6 @@
import uvicorn import uvicorn
from fastapi import FastAPI, Request, HTTPException from fastapi import FastAPI, Request, HTTPException
from fastapi.responses import HTMLResponse
from dotenv import load_dotenv from dotenv import load_dotenv
import logging import logging
from typing import List from typing import List
@@ -11,9 +12,20 @@ from gitea_request import GiteaRequest
app = FastAPI() app = FastAPI()
@app.get('/') @app.get('/', response_class=HTMLResponse)
async def root(): async def root():
return '<h1>Welcome to Gitea Runsner</h1>' content_str = """
<html>
<head>
<title>Gitea Runner</title>
</head>
<body>
<h1>Welcome to Gitea Runner</h1>
<p>see /docs for more information</p>
</body>
</html>
"""
return HTMLResponse(content=content_str, status_code=200)
@app.post('/test') @app.post('/test')
async def test(request: Request): async def test(request: Request):
@@ -48,7 +60,7 @@ def handle_event(request: GiteaRequest):
) )
# load runner commands # load runner commands
# send response # send response
raise HTTPException( raise HTTPException(
status_code=202, status_code=202,