Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 31 in api/main.py

View workflow job for this annotation

GitHub Actions / Lint

line too long (89 > 79 characters)
from fastapi.security import OAuth2PasswordRequestForm
from fastapi_pagination import add_pagination
from fastapi_versioning import VersionedFastAPI
Expand All @@ -36,7 +36,7 @@
from fastapi_users import FastAPIUsers
from beanie import PydanticObjectId
from pydantic import BaseModel
from kernelci.api.models import (

Check failure on line 39 in api/main.py

View workflow job for this annotation

GitHub Actions / Lint

Unable to import 'kernelci.api.models'
Node,
Hierarchy,
PublishEvent,
Expand Down Expand Up @@ -132,7 +132,10 @@
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
Expand Down
28 changes: 28 additions & 0 deletions api/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KernelCI API Server</title>
<style>
body { font-family: Arial, sans-serif; background: #f8f9fa; color: #222; margin: 0; padding: 0; }
.container { max-width: 600px; margin: 60px auto; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); padding: 32px; }
h1 { color: #0057b7; }
a { color: #0057b7; text-decoration: none; }
a:hover { text-decoration: underline; }
.logo { width: 120px; margin-bottom: 24px; }
</style>
</head>
<body>
<div class="container">
<img src="https://kernelci.org/wp-content/uploads/sites/92/2019/10/kernelci-horizontal-color.svg" alt="KernelCI Logo" class="logo"/>
<h1>KernelCI API Server</h1>
<p>Welcome! This is the <b>KernelCI API</b> server endpoint.</p>
<p>Use this service to interact with the KernelCI Maestro API via RESTful API calls.</p>
<p>For more information about KernelCI, please visit <a href="https://kernelci.org/" target="_blank">kernelci.org</a>.</p>
<p>API documentation and usage instructions can be found in the <a href="https://docs.kernelci.org/" target="_blank">KernelCI documentation</a>.</p>
<hr/>
<p style="font-size: 0.95em; color: #888;">&copy; 2025 KernelCI Project</p>
</div>
</body>
</html>
Loading