aboutsummaryrefslogtreecommitdiff
path: root/api/status.py
blob: a609d42770e6145185c1f6047cafde34b7a4228a (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
25
26
27
28
from flask import Blueprint
from db import cursor
import json

version = {
    "number": json.loads(open("package.json", "r").read())["version"],
    "commit": open(".git/refs/heads/master", "r").read().strip()
}

status = Blueprint('server_status', __name__)


@status.route('/status')
def index():
    return {
        # "users": int,
        "games":
        len(
            cursor.execute(
                "select game_id from games where status = \"in_progress\""
            ).fetchall()
        ),
        "version":
        version
    }


dynamic_route = ["/", status]