users and status working
This commit is contained in:
24
app/main.py
Normal file
24
app/main.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user