Emmanuel Frimpong Asante
update space
658e692
raw
history blame
938 Bytes
# app.py
from fastapi import FastAPI, Request, HTTPException
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from routes.authentication import auth_router
import os
# Initialize FastAPI app and template directory
app = FastAPI()
templates = Jinja2Templates(directory="templates")
# Mount static files if the directory exists
static_dir = "static"
if os.path.isdir(static_dir):
app.mount("/static", StaticFiles(directory=static_dir), name="static")
else:
raise HTTPException(status_code=500, detail="Static directory not found.")
# Include authentication routes
app.include_router(auth_router, prefix="/auth", tags=["Authentication"])
@app.get("/", response_class=HTMLResponse)
async def landing_page(request: Request):
"""Render the landing page template."""
return templates.TemplateResponse("landing.html", {"request": request})