From 3d8c809e649df93c57b8d509a89da13cb685e1ad Mon Sep 17 00:00:00 2001 From: codl Date: Sun, 15 Oct 2017 20:38:39 +0200 Subject: [PATCH] add health check endpoint --- routes/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/routes/api.py b/routes/api.py index 1d86bcc..835ba22 100644 --- a/routes/api.py +++ b/routes/api.py @@ -5,6 +5,14 @@ from model import Account import libforget.settings import libforget.json +@app.route('/api/health_check') +def health_check(): + try: + db.session.execute('SELECT 1') + return 'ok' + except Exception: + return ('bad', 500) + @app.route('/api/settings', methods=('PUT',)) @require_auth_api