Loading app/controller/healthcheck.py 0 → 100644 +21 −0 Original line number Diff line number Diff line from flask import Blueprint, current_app from helpers.limiter import limiter healthcheck_bp = Blueprint('healthcheck', __name__) @healthcheck_bp.route('/healthcheck', methods=['GET']) @limiter.exempt def healthcheck(): # Get a connection from the pool with current_app.db_pool.connection() as conn: with conn.cursor() as cur: cur.execute("SELECT version();") version = cur.fetchone()[0] count = current_app.redis.incr('hits') current_app.redis.set("test_key", "Hello from Redis!") value = current_app.redis.get("test_key").decode('utf-8') return f"Hello World! I have been seen {count} times.<br>{value}<br>PostgreSQL version: {version}<br>redis://{current_app.config['REDIS_HOST']}:{current_app.config['REDIS_PORT']}" Loading
app/controller/healthcheck.py 0 → 100644 +21 −0 Original line number Diff line number Diff line from flask import Blueprint, current_app from helpers.limiter import limiter healthcheck_bp = Blueprint('healthcheck', __name__) @healthcheck_bp.route('/healthcheck', methods=['GET']) @limiter.exempt def healthcheck(): # Get a connection from the pool with current_app.db_pool.connection() as conn: with conn.cursor() as cur: cur.execute("SELECT version();") version = cur.fetchone()[0] count = current_app.redis.incr('hits') current_app.redis.set("test_key", "Hello from Redis!") value = current_app.redis.get("test_key").decode('utf-8') return f"Hello World! I have been seen {count} times.<br>{value}<br>PostgreSQL version: {version}<br>redis://{current_app.config['REDIS_HOST']}:{current_app.config['REDIS_PORT']}"