Skip to content

Commit

Permalink
Try new decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
nnayk committed Dec 8, 2023
1 parent bbaa928 commit eeea28b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Backend/db_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@

app = Flask(__name__)

CONNECTION = None

def db_connect(DB_URL=None):

@app.before_request
def db_connect(DB_URL=None, connection=None):
# MongoDB connection
mongo_uri = DB_URL or os.environ.get("MONGO_URI")
connect(alias="default", host=mongo_uri)
return True
return connection


class Response:
Expand Down

0 comments on commit eeea28b

Please sign in to comment.