Spaces:
Sleeping
Sleeping
# File: main.py | |
from fastapi import FastAPI | |
from contextlib import asynccontextmanager | |
from routes import router | |
from db_schema import init_db | |
async def lifespan(app: FastAPI): | |
print("🚀 Server is starting up...") | |
# Ensure SQLite tables exist before handling requests | |
init_db() | |
yield | |
print("🧹 Server is shutting down... Cleaned up!") | |
app = FastAPI( | |
title="Swiggy Email API", | |
description="Extract Swiggy orders from Gmail", | |
version="1.0.0", | |
lifespan=lifespan | |
) | |
app.include_router(router) | |
# Run with: uvicorn main:app --reload | |