26 lines
516 B
Python
26 lines
516 B
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from hub.auth import oauth_router
|
|
|
|
if __name__ == '__main__':
|
|
import uvicorn
|
|
uvicorn.run("main:app", host='0.0.0.0', port=8000, reload=True)
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
# create_db_and_tables()
|
|
# create_admin_user()
|
|
yield
|
|
# do something before end
|
|
|
|
app = FastAPI(root_path="/api/v1", lifespan=lifespan)
|
|
|
|
app.include_router(
|
|
oauth_router,
|
|
prefix="/auth/google",
|
|
tags=["auth"],
|
|
)
|