summaryrefslogtreecommitdiff
path: root/python/routes.py
blob: a60584dc209275d18849d7ab307dcb4331e1022f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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"
            )
        )