This commit is contained in:
Ruud committed 2012-02-11 23:29:59 +01:00
1 parent 526f894344
commit 7470e3dacd
4 files changed
-44

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
from couchpotato.core.helpers.request import jsonified
from flask.blueprints import Blueprint
api = Blueprint('api', __name__)
def addApiView(route, func, static = False):
api.add_url_rule(route + ('' if static else '/'), endpoint = route.replace('.', '-') if route else 'index', view_func = func)
""" Api view """
def index():
from couchpotato import app
routes = []
for route, x in sorted(app.view_functions.iteritems()):
if route[0:4] == 'api.':
routes += [route[4:]]
return jsonified({'routes': routes})
addApiView('', index)
addApiView('default', index)