diff --git a/server/corvus/__init__.py b/server/corvus/__init__.py index 998e2eb..88c5f15 100644 --- a/server/corvus/__init__.py +++ b/server/corvus/__init__.py @@ -81,9 +81,10 @@ def register_blueprints(app: Flask) -> None: :param app: :return: """ - from corvus.api import AUTH_BLUEPRINT, USER_BLUEPRINT + from corvus.api import AUTH_BLUEPRINT, USER_BLUEPRINT, HEALTH_BLUEPRINT app.register_blueprint(AUTH_BLUEPRINT) app.register_blueprint(USER_BLUEPRINT) + app.register_blueprint(HEALTH_BLUEPRINT) def register_error_handlers(app: Flask) -> None: diff --git a/server/corvus/api/__init__.py b/server/corvus/api/__init__.py index 3d4018b..1a0860a 100644 --- a/server/corvus/api/__init__.py +++ b/server/corvus/api/__init__.py @@ -1,3 +1,4 @@ """API blueprint exports.""" from corvus.api.authentication_api import AUTH_BLUEPRINT from corvus.api.user_api import USER_BLUEPRINT +from corvus.api.health_api import HEALTH_BLUEPRINT diff --git a/server/corvus/api/health_api.py b/server/corvus/api/health_api.py new file mode 100644 index 0000000..2c97f20 --- /dev/null +++ b/server/corvus/api/health_api.py @@ -0,0 +1,17 @@ +"""Endpoint to expose the health of the application""" +from flask import Blueprint + +from corvus.api.decorators import return_json +from corvus.api.model import APIResponse, APIMessage + +HEALTH_BLUEPRINT = Blueprint( + name='health', import_name=__name__, url_prefix='/health') + + +@HEALTH_BLUEPRINT.route('', methods=['GET']) +@return_json +def get_health() -> APIResponse: + return APIResponse( + APIMessage(True, 'Service is healthy'), + 200 + )