Skip to content

Commit

Permalink
feat: Add redirect to document page (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj authored Mar 29, 2024
1 parent 922e0ce commit 665c26c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-ads-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-llama": patch
---

Add redirect to documentation page when accessing the base URL
7 changes: 7 additions & 0 deletions templates/types/streaming/fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import RedirectResponse
from app.api.routers.chat import chat_router
from app.settings import init_settings

Expand All @@ -29,6 +30,12 @@
allow_headers=["*"],
)

# Redirect to documentation page when accessing base URL
@app.get("/")
async def redirect_to_docs():
return RedirectResponse(url="/docs")


app.include_router(chat_router, prefix="/api/chat")


Expand Down

0 comments on commit 665c26c

Please sign in to comment.