|
123456789101112131415161718192021222324252627282930 |
- from fastapi import FastAPI
- from core.config import settings
- 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)
- 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"}}
|