From 42836875ffa86c61d1fa470ee2fa86ca1dca6f4d Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Fri, 6 Jun 2025 16:26:48 +0300 Subject: [PATCH] (api) Add nice index page Signed-off-by: Denys Fedoryshchenko --- api/main.py | 7 +++++-- api/templates/index.html | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 api/templates/index.html diff --git a/api/main.py b/api/main.py index a1596c75..07006bbf 100644 --- a/api/main.py +++ b/api/main.py @@ -28,7 +28,7 @@ Body, ) from fastapi.encoders import jsonable_encoder -from fastapi.responses import JSONResponse, PlainTextResponse, FileResponse +from fastapi.responses import JSONResponse, PlainTextResponse, FileResponse, HTMLResponse from fastapi.security import OAuth2PasswordRequestForm from fastapi_pagination import add_pagination from fastapi_versioning import VersionedFastAPI @@ -132,7 +132,10 @@ async def invalid_id_exception_handler( async def root(): """Root endpoint handler""" metrics.add('http_requests_total', 1) - return {"message": "KernelCI API"} + root_dir = os.path.dirname(os.path.abspath(__file__)) + index_path = os.path.join(root_dir, 'templates', 'index.html') + with open(index_path, 'r', encoding='utf-8') as file: + return HTMLResponse(file.read()) # ----------------------------------------------------------------------------- # Users diff --git a/api/templates/index.html b/api/templates/index.html new file mode 100644 index 00000000..86004480 --- /dev/null +++ b/api/templates/index.html @@ -0,0 +1,28 @@ + + + + + + KernelCI API Server + + + +
+ +

KernelCI API Server

+

Welcome! This is the KernelCI API server endpoint.

+

Use this service to interact with the KernelCI Maestro API via RESTful API calls.

+

For more information about KernelCI, please visit kernelci.org.

+

API documentation and usage instructions can be found in the KernelCI documentation.

+
+

© 2025 KernelCI Project

+
+ + \ No newline at end of file