seo improvement and updated notifs
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
from fastapi import FastAPI, HTTPException, Depends
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from db import MongoDB, get_database
|
||||
from db import MongoDB
|
||||
from config import get_settings
|
||||
from routers import entries, users
|
||||
from routers import notifications
|
||||
from scheduler import start_scheduler
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
settings = get_settings()
|
||||
_scheduler = None
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# Startup
|
||||
MongoDB.connect_db()
|
||||
global _scheduler
|
||||
_scheduler = start_scheduler()
|
||||
yield
|
||||
# Shutdown
|
||||
if _scheduler:
|
||||
_scheduler.shutdown(wait=False)
|
||||
MongoDB.close_db()
|
||||
|
||||
app = FastAPI(
|
||||
@@ -43,6 +50,7 @@ app.add_middleware(
|
||||
# Include routers
|
||||
app.include_router(users.router, prefix="/api/users", tags=["users"])
|
||||
app.include_router(entries.router, prefix="/api/entries", tags=["entries"])
|
||||
app.include_router(notifications.router, prefix="/api/notifications", tags=["notifications"])
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user