|
12345678910111213141516171819202122232425262728293031323334 |
- from fastapi import FastAPI
- from core.config import settings, createAdminAcc
- from db.session import engine
- from db.base import Base
- from apis.base import api_router
-
-
- def include_routes(app): # include all routes from our api/v1/
- app.include_router(api_router)
-
-
- def startup(): # start the project, and create the tables
- app = FastAPI(
- title=settings.PROJECT_NAME,
- version=settings.PROJECT_VERSION,
- )
- Base.metadata.create_all(bind=engine)
- createAdminAcc()
- include_routes(app)
- return app
-
-
- app = startup()
-
-
- # Testing stuff
- @app.get("/")
- def root():
- return {"message": "Hello World!"}
-
-
- @app.get("/user")
- def get_users():
- return {{"name": "almaz"}, {"name": "madi"}}
|