From 176a012f4b70cfb89c93af954a410afc86e42835 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 25 Oct 2020 19:50:43 +0000 Subject: Add some basic routes --- backend/routes/index.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 backend/routes/index.py (limited to 'backend/routes/index.py') diff --git a/backend/routes/index.py b/backend/routes/index.py new file mode 100644 index 0000000..1b5b404 --- /dev/null +++ b/backend/routes/index.py @@ -0,0 +1,24 @@ +""" +Index route for the forms API. +""" + +from starlette.responses import JSONResponse + +from backend.route import Route + + +class IndexRoute(Route): + """ + Return a generic hello world message with some information to the client. + + Can be used as a healthcheck for Kubernetes or a frontend connection check. + """ + + name = "index" + path = "/" + + def get(self, request): + return JSONResponse({ + "message": "Hello, world!", + "client": request.client.host + }) -- cgit v1.2.3