diff --git a/areas/__init__.py b/areas/__init__.py index 4cd2077..1ab3870 100644 --- a/areas/__init__.py +++ b/areas/__init__.py @@ -1,3 +1,9 @@ from flask import Blueprint -api_v1 = Blueprint('api_v1', __name__, url_prefix='/api/v1') +api_v1 = Blueprint("api_v1", __name__, url_prefix="/api/v1") + + +@api_v1.route("/") +@api_v1.route("/health") +def api_index(): + return "Open App Stack API v1.0" diff --git a/helpers/error_handler.py b/helpers/error_handler.py index 4c19498..69c6c4d 100644 --- a/helpers/error_handler.py +++ b/helpers/error_handler.py @@ -12,7 +12,7 @@ class BadRequest(Exception): def bad_request_error(e): message = e.args[0] if e.args else "Bad request to the server." - return jsonify({"errorMessage": message}) + return jsonify({"errorMessage": message}), 400 def validation_error(e): @@ -24,11 +24,11 @@ def validation_error(e): def kratos_error(e): - message = e.args[0] if e.args else "Failed to contant Kratos." + message = e.args[0] if e.args else "Failed to contact Kratos." status_code = e.args[1] if e.args else 500 return jsonify({"errorMessage": message}), status_code def global_error(e): - message = e.args[0] if e.args else "Something went wrong." + message = str(e) return jsonify({"errorMessage": message})