aboutsummaryrefslogtreecommitdiff
path: root/uploader/base_routes.py
blob: 9daf4393b6c30b4be2ab24aade10970042c5de19 (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
29
"""Basic routes required for all pages"""
import os
from flask import Blueprint, send_from_directory

base = Blueprint("base", __name__)

def appenv():
    """Get app's guix environment path."""
    return os.environ.get("GN_UPLOADER_ENVIRONMENT")

@base.route("/bootstrap/<path:filename>")
def bootstrap(filename):
    """Fetch bootstrap files."""
    return send_from_directory(
        appenv(), f"share/genenetwork2/javascript/bootstrap/{filename}")


@base.route("/jquery/<path:filename>")
def jquery(filename):
    """Fetch jquery files."""
    return send_from_directory(
        appenv(), f"share/genenetwork2/javascript/jquery/{filename}")


@base.route("/node-modules/<path:filename>")
def node_modules(filename):
    """Fetch node-js modules."""
    return send_from_directory(
        appenv(), f"lib/node_modules/{filename}")