diff --git a/src/main.py b/src/main.py index 18a409c..043cd70 100644 --- a/src/main.py +++ b/src/main.py @@ -1,16 +1,14 @@ -from routes import user, health -import middleware.auth_guard as auth_guard from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import os import redis from database.postgres_db import dbEngine, Base import database.redis_db as redis +from restful_ressources import import_resources app_version = os.environ['APP_VERSION'] app_title = os.environ['APP_TITLE'] app_description = os.environ['APP_DESCRIPTION'] -v = os.environ['API_VERSION'] Base.metadata.create_all(bind=dbEngine) redis.init() @@ -31,6 +29,4 @@ allow_headers=["*"], ) -app.include_router(health.router, tags=['Information'], prefix=f'/{v}') -app.include_router(auth_guard.router, tags=['Access Token'], prefix=f'/{v}') -app.include_router(user.router, tags=['User'], prefix=f'/{v}/user') \ No newline at end of file +import_resources(app) \ No newline at end of file diff --git a/src/restful_ressources.py b/src/restful_ressources.py new file mode 100644 index 0000000..59f9359 --- /dev/null +++ b/src/restful_ressources.py @@ -0,0 +1,11 @@ + +import os +from routes import user, health +import middleware.auth_guard as auth_guard + +v = os.environ['API_VERSION'] + +def import_resources(app): + app.include_router(health.router, tags=['Information'], prefix=f'/{v}') + app.include_router(auth_guard.router, tags=['Access Token'], prefix=f'/{v}') + app.include_router(user.router, tags=['User'], prefix=f'/{v}/user') \ No newline at end of file