import json
import flask_login
from server import app, auth
from flask import jsonify

SORT_SOCIAL = 'social'
SORT_INLINK = 'inlink'
CACHED_TOPICS = json.load(open('./server/static/data/all_topics.json'))

def validated_sort(desired_sort, default_sort=SORT_SOCIAL):
    valid_sorts = [SORT_SOCIAL, SORT_INLINK]
    if (desired_sort is None) or (desired_sort not in valid_sorts):
        return default_sort
    return desired_sort

@app.route('/api/topics/fetchMatchingTopics', methods=['GET'])
@flask_login.login_required
def topic_search():
	return jsonify({'list': CACHED_TOPICS['topics']})

@@ -24,16 +24,26 @@
 k_login%0A
+import os%0A
 from ser
@@ -62,12 +62,16 @@
 pp, 
-auth
+base_dir
 %0Afro
@@ -175,30 +175,60 @@
 pen(
-'./
+os.path.join(base_dir, '
 server
-/
+', '
 static
-/data/
+', 'data', '
 all_
@@ -241,16 +241,17 @@
 .json'))
+)
 %0A%0Adef va

use absolute path to all_topics.json