#!/usr/bin/env python3 """ Static file server for serving HTML templates """ import os from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from fastapi.responses import HTMLResponse # Create a separate app for static files static_app = FastAPI() # Create templates directory if it doesn't exist os.makedirs("templates", exist_ok=True) # Mount static files static_app.mount("/templates", StaticFiles(directory="templates"), name="templates") # Serve index.html at root if os.path.exists("templates/index.html"): @static_app.get("/", response_class=HTMLResponse) async def read_index(): with open("templates/index.html", "r", encoding="utf-8") as f: return f.read() else: @static_app.get("/", response_class=HTMLResponse) async def read_index(): return """ Enhanced DOCX to PDF Converter

Enhanced DOCX to PDF Converter

API is running. Visit /docs for API documentation.

"""