summaryrefslogtreecommitdiff
path: root/python/routes.py
diff options
context:
space:
mode:
authornil0j <nil.jimeno@estudiant.fjaverianas.com>2024-09-21 10:17:23 +0200
committernil0j <nil.jimeno@estudiant.fjaverianas.com>2024-09-21 10:17:23 +0200
commitfaa13839f898c60ff5618be6e916ad2e60958468 (patch)
treed785b9e7c66d092c0e5fbc296382289f39fea501 /python/routes.py
init
Diffstat (limited to 'python/routes.py')
-rw-r--r--python/routes.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/routes.py b/python/routes.py
new file mode 100644
index 0000000..a60584d
--- /dev/null
+++ b/python/routes.py
@@ -0,0 +1,24 @@
+from flask import Flask, jsonify, request
+import database
+
+
+def createApp():
+ return Flask(__name__)
+
+
+def createRoutes(app, connector):
+ @app.route("/", methods=['GET'])
+ def hello_world():
+ arg1 = request.args.get('arg1')
+ arg2 = request.args.get('arg2')
+ return jsonify({'arg1': arg1,
+ 'arg2': arg2})
+
+ @app.route("/db", methods=['GET'])
+ def database_hello():
+ return jsonify(
+ database.runQuery(
+ connector,
+ "SHOW DATABASES"
+ )
+ )