Files
pdf/gateway/app/main.py
T

47 lines
1.1 KiB
Python
Raw Normal View History

2026-05-16 11:01:20 +05:30
"""FastAPI app factory."""
from fastapi import FastAPI
2026-05-26 15:54:49 +05:30
from fastapi.middleware.cors import CORSMiddleware
2026-05-16 11:01:20 +05:30
from app import __version__
2026-07-09 10:26:11 +05:30
from app.routers import documents, edits, health, info, internal, render
2026-05-16 11:01:20 +05:30
def create_app() -> FastAPI:
app = FastAPI(
title="PDF Engine Gateway",
version=__version__,
description="Auth, metadata, storage, and job-queue gateway over the C++ PDF engine.",
)
2026-05-26 15:54:49 +05:30
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
2026-05-16 11:01:20 +05:30
app.include_router(health.router)
2026-05-26 17:39:03 +05:30
app.include_router(info.router)
2026-05-16 11:01:20 +05:30
app.include_router(documents.router)
app.include_router(render.router)
2026-05-22 15:47:48 +05:30
app.include_router(render.compat_router)
2026-05-16 11:01:20 +05:30
app.include_router(edits.router)
2026-05-22 15:47:48 +05:30
app.include_router(edits.compat_router)
2026-07-09 10:26:11 +05:30
app.include_router(internal.router)
2026-05-16 11:01:20 +05:30
2026-05-27 12:25:00 +05:30
@app.get("/")
def read_root():
return {
"name": "PDF Engine Gateway",
"version": __version__,
"health": "/health",
"docs": "/docs",
2026-05-27 12:25:00 +05:30
}
2026-05-16 11:01:20 +05:30
return app
app = create_app()