33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
import logging
|
|
|
|
import fastapi
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from pydantic import BaseModel
|
|
from fastapi import FastAPI,APIRouter
|
|
from db_setup import lifespan
|
|
from inbox.app import router as inbox_router
|
|
from users.app import router as users_router
|
|
from role.app import router as role_router
|
|
from forget_password.app import router as forget_password_router
|
|
from job.app import router as candidate_router
|
|
from notifications.app import router as confirmation_router
|
|
# Without this the db/migration logs have no handler and are swallowed under uvicorn.
|
|
logging.basicConfig(level=logging.INFO, format="%(levelname)-8s %(name)s: %(message)s")
|
|
|
|
# lifespan connects to Postgres and brings migrations up to head on startup,
|
|
# and disposes of the connection pool on shutdown.
|
|
app = FastAPI(lifespan=lifespan)
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(inbox_router)
|
|
app.include_router(users_router)
|
|
app.include_router(role_router)
|
|
app.include_router(forget_password_router)
|
|
app.include_router(confirmation_router)
|
|
app.include_router(candidate_router) |