24 lines
398 B
Python
24 lines
398 B
Python
import asyncio
|
|
from contextlib import asynccontextmanager
|
|
from fastapi import FastAPI
|
|
from app import api_router
|
|
from utils.scripts import startup, shutdown
|
|
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
await startup()
|
|
yield
|
|
await shutdown()
|
|
|
|
|
|
|
|
app = FastAPI(lifespan=lifespan)
|
|
|
|
app.include_router(router=api_router)
|
|
|
|
@app.get('/ping')
|
|
async def ping():
|
|
return 'Ok'
|