diff options
Diffstat (limited to 'ick2/controllerapi.py')
-rw-r--r-- | ick2/controllerapi.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py index 70877f1..ef93f54 100644 --- a/ick2/controllerapi.py +++ b/ick2/controllerapi.py @@ -17,6 +17,7 @@ import apifw import ick2 +import ick2version class ControllerAPI: @@ -36,6 +37,11 @@ class ControllerAPI: def find_missing_route(self, path): # pragma: no cover return [ { + 'method': 'GET', + 'path': '/version', + 'callback': self.get_version, + }, + { 'method': 'POST', 'path': '/projects', 'callback': self.post_callback(self.post_projects), @@ -62,6 +68,17 @@ class ControllerAPI: }, ] + def get_version(self, *args, **kwargs): + return apifw.Response({ + 'status': apifw.HTTP_OK, + 'body': { + 'version': ick2version.__version__, + }, + 'headers': { + 'Content-Type': 'application/json', + }, + }) + def get_callback(self, callback): # pragma: no cover def wrapper(content_type, body, **kwargs): try: |