mini-rbac/backend/main.py

22 lines
491 B
Python
Raw Normal View History

2022-09-11 10:34:18 +00:00
from fastapi import FastAPI
from core.events import close_orm, init_orm
2022-09-13 05:31:15 +00:00
from core.exceptions import exception_handlers
2022-09-12 15:22:18 +00:00
from core.log import logger
2022-09-12 07:11:12 +00:00
from core.middleware import middlewares
2022-10-04 04:40:11 +00:00
from core.utils import load_routers
2022-09-11 10:34:18 +00:00
app = FastAPI(
2022-09-12 07:11:12 +00:00
on_startup=[init_orm],
2022-09-11 10:34:18 +00:00
on_shutdown=[close_orm],
2022-09-12 07:11:12 +00:00
middleware=middlewares,
2022-09-13 05:31:15 +00:00
exception_handlers=exception_handlers,
2022-09-11 10:34:18 +00:00
)
2022-10-04 04:40:11 +00:00
load_routers(app, "controller")
2022-09-16 17:11:21 +00:00
2022-09-12 07:11:12 +00:00
if __name__ == "__main__":
import uvicorn
2022-09-11 10:34:18 +00:00
2022-09-12 07:11:12 +00:00
uvicorn.run("main:app", reload=True)