Commit c54b123f authored by Nicolas Joyard's avatar Nicolas Joyard

Ajout multichambre

parent 50efbb0c
......@@ -28,7 +28,7 @@ from ..models import (
)
def setup_api(app):
def setup_an_api(app):
api = API(app)
api.endpoint(
......
......@@ -9,9 +9,9 @@ import humanize
from .models import Job
def setup_routes(app, rest_api, graphql_api):
rest_prefix = '/rest/'
rest_api.setup_routes(app, rest_prefix)
def setup_routes(app, rest_apis, graphql_api):
for chamber, rest_api in rest_apis.items():
rest_api.setup_routes(app, '/rest/{}/'.format(chamber))
graphql_prefix = '/graphql/'
graphql_api.setup_routes(app, graphql_prefix)
......@@ -51,8 +51,7 @@ def setup_routes(app, rest_api, graphql_api):
return render_template(
'index.html',
piwik=piwik,
rest_api=rest_api.summary,
rest_prefix=rest_prefix,
rest_apis={ k: v.summary for k, v in rest_apis.items() },
graphql_prefix=graphql_prefix,
jobs=Job.query.all()
)
......@@ -19,8 +19,8 @@ def setup_app(name):
db.init_app(app)
# Setup REST API
from .rest.setup import setup_api as setup_rest_api
rest_api = setup_rest_api(app)
from .rest.setup import setup_an_api as setup_an_rest_api
an_rest_api = setup_an_rest_api(app)
# Setup GraphQL API
from .graphql.setup import setup_api as setup_graphql_api
......@@ -28,6 +28,6 @@ def setup_app(name):
# Setup routes
from .routes import setup_routes
setup_routes(app, rest_api, graphql_api)
setup_routes(app, { 'an': an_rest_api }, graphql_api)
return app
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment