summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-11-03 16:58:42 +0200
committerLars Wirzenius <liw@liw.fi>2018-11-03 16:58:42 +0200
commitfb756526af092ffb6424dc254fff928cbdd4135a (patch)
tree0dd5e839929fc37f874d91c8649f02a7b1c4b52d
parent65d14fd03b74e319b24499e63076d9c6ce99e5a8 (diff)
downloadmuck-poc-fb756526af092ffb6424dc254fff928cbdd4135a.tar.gz
Add: /status endpoint
-rwxr-xr-xmuck_poc12
1 files changed, 12 insertions, 0 deletions
diff --git a/muck_poc b/muck_poc
index 40f59ba..4b19266 100755
--- a/muck_poc
+++ b/muck_poc
@@ -64,6 +64,11 @@ class MuckAPI:
'callback': self._check_authz(
'GET', 'show', self._search_res),
},
+ {
+ 'method': 'GET',
+ 'path': '/status',
+ 'callback': self._show_status,
+ },
]
for route in routes:
@@ -134,6 +139,13 @@ class MuckAPI:
}
return bottle.HTTPResponse(status=200, body=json.dumps(result))
+ def _show_status(self):
+ ms = self._store.get_memory_store()
+ status = {
+ 'resources': len(ms)
+ }
+ return bottle.HTTPResponse(status=200, body=json.dumps(status))
+
def _get_json_body(self):
f = bottle.request.body
body = f.read()