Integrate FastScheduler with FastAPI
mainAdd a real-time monitoring dashboard to your FastAPI application using create_scheduler_routes. The dashboard is accessible via the routes you include in your app.
from fastapi import FastAPI
from fastscheduler import FastScheduler
from fastscheduler.fastapi_integration import create_scheduler_routes
app = FastAPI()
scheduler = FastScheduler(quiet=True)
# Add dashboard at /scheduler/
app.include_router(create_scheduler_routes(scheduler))
@scheduler.every(30).seconds
def background_task():
print("Background work")
scheduler.start()