Resume-Parser / app /main.py
SyedAzlanzar
@feat : cover letter enhanced, cl upload file, comment out some hf code.
67ba1ec
raw
history blame
1.04 kB
from fastapi import FastAPI, Request
from fastapi.staticfiles import StaticFiles
from app.api.routes import router
import os
import logging
from dotenv import load_dotenv
logging.basicConfig(level=logging.INFO)
app = FastAPI(title="Cover Letter Generator")
load_dotenv()
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# Serve resumes (these are static, bundled in repo, read-only is fine)
app.mount(
"/resumes",
StaticFiles(directory=os.path.join(BASE_DIR, "static/resumes")),
name="resumes"
)
# Writable directory for PDFs
PDF_DIR = "/tmp/pdfs"
os.makedirs(PDF_DIR, exist_ok=True)
# Serve PDFs (generated at runtime) under /static/pdfs
app.mount("/static/pdfs", StaticFiles(directory=PDF_DIR), name="pdfs")
@app.middleware("http")
async def log_requests(request: Request, call_next):
logging.info(f"API hit: {request.method} {request.url}")
response = await call_next(request)
return response
@app.get("/")
def ping():
return {"status": "ok"}
# Register routes
app.include_router(router)