Add root html endpoint
This commit is contained in:
parent
fed9f0a3d8
commit
450ec9d692
1 changed files with 19 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ from uuid import uuid4
|
|||
import feedparser
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import HTMLResponse
|
||||
from groq import Groq
|
||||
|
||||
BEE_FEED = "https://babylonbee.com/feed"
|
||||
|
|
@ -185,6 +186,24 @@ def improve_summary(original_title: str, new_title: str, original_summary: str):
|
|||
return rewrite_summary_with_groq(o, new_title)
|
||||
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
def root_route():
|
||||
return """
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>FastAPI with HTMX</title>
|
||||
<script src="https://unpkg.com/htmx.org@1.6.1"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to FastAPI with HTMX</h1>
|
||||
<div id="content"></div>
|
||||
<button hx-get="/fetch-data" hx-target="#content">Fetch Data</button>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
def start() -> None:
|
||||
from uvicorn import run
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue