Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the router as JavaScript #234

Open
cescoffier opened this issue Jun 22, 2014 · 0 comments
Open

Expose the router as JavaScript #234

cescoffier opened this issue Jun 22, 2014 · 0 comments
Labels

Comments

@cescoffier
Copy link
Member

We should allow web pages to retrieve the routes available in the systems.

This should be done in two steps:

  1. Allow the retrieval of routes from JavaScript using an AJAX call.
  2. Provide a JavaScript helper object easing the interaction with this new service.

For the first point, something like:

$.getJSON("/wisdom/routes").success(function(routes() { ... } ); // Get all routes
$.getJSON("/wisdom/routes?controller=...&method=...").success(function(routes() { ... } ); // Filter routes

Route objects are composed of the HTTP Method, the URL and the potential parameters.

The second point expose a higher-level API to invoke the routes:

var router = new Router();
router.getRouteFor(controller, method).invoke({
    parameter : {parameters},
    success : function(result) { },
    error : function(code, error) {}
   });

The invoke method should allow other JQuery-like attributes (async, ....)
Behind the hood, JQuery is used.

@cescoffier cescoffier added this to the 0.6 milestone Jun 22, 2014
@jenf11 jenf11 modified the milestones: 0.7, 0.6 Jun 27, 2014
@cescoffier cescoffier modified the milestones: 0.7, 0.7.1 Dec 26, 2014
@cescoffier cescoffier modified the milestones: 0.7.2, 0.7.1 Mar 4, 2015
@cescoffier cescoffier removed this from the 0.9.0 milestone May 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants