|
|
@ -35,9 +35,10 @@ app_index = {c: {} for c in CORPORA}
|
|
|
|
|
|
|
|
|
|
|
|
# when running vuejs via webpack
|
|
|
|
# when running vuejs via webpack
|
|
|
|
# CORS(app)
|
|
|
|
# CORS(app)
|
|
|
|
CORS(app, resources={r"/api/*": {
|
|
|
|
# CORS(app, resources={r"/api/*": {
|
|
|
|
"origins": "*",
|
|
|
|
# "origins": "*",
|
|
|
|
}})
|
|
|
|
# }})
|
|
|
|
|
|
|
|
CORS(app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# for testing functions
|
|
|
|
# for testing functions
|
|
|
@ -58,18 +59,15 @@ def home(pathname):
|
|
|
|
return redirect(url_for("index"), code=302)
|
|
|
|
return redirect(url_for("index"), code=302)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# @app.route("/api/words/<corpus>")
|
|
|
|
@app.route("/api/words/<corpus>")
|
|
|
|
# def api_words(corpus):
|
|
|
|
def api_words(corpus):
|
|
|
|
@app.route("/api/words")
|
|
|
|
|
|
|
|
def api_words():
|
|
|
|
|
|
|
|
return json.dumps({
|
|
|
|
return json.dumps({
|
|
|
|
"sorted_words": app_index["ssj"]["words"], # todo - make corpus as arg
|
|
|
|
"sorted_words": app_index[corpus]["words"], # todo - make corpus as arg
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/api/functors")
|
|
|
|
@app.route("/api/functors/<corpus>")
|
|
|
|
def api_functors():
|
|
|
|
def api_functors(corpus):
|
|
|
|
# return array ([functor, len])
|
|
|
|
return json.dumps(app_index[corpus]["functors"])
|
|
|
|
return json.dumps(app_index["ssj"]["functors"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/api/register", methods=["POST"])
|
|
|
|
@app.route("/api/register", methods=["POST"])
|
|
|
|