25 lines
609 B
Python
25 lines
609 B
Python
from contextlib import asynccontextmanager
|
|
from typing import Annotated
|
|
|
|
from fastapi.security import OAuth2PasswordRequestForm
|
|
|
|
from app.alchemy import Base
|
|
from app.dependencies import engine
|
|
from fastapi import FastAPI, Depends, HTTPException
|
|
from starlette.middleware.cors import CORSMiddleware
|
|
from app import routers
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
Base.metadata.create_all(engine)
|
|
yield
|
|
|
|
app = FastAPI(lifespan=lifespan)
|
|
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"])
|
|
|
|
|
|
app.include_router(routers.status)
|
|
app.include_router(routers.user)
|
|
|