Skip to content

Instantly share code, notes, and snippets.

@imalberto
Last active December 22, 2015 16:49
Show Gist options
  • Select an option

  • Save imalberto/6501549 to your computer and use it in GitHub Desktop.

Select an option

Save imalberto/6501549 to your computer and use it in GitHub Desktop.
how to deal with this routes.json config with the updated scheme
{
// foo, get#foo-index
"foo": {
"path": "/foo",
"verbs": [ "get" ],
"call": "foo.index",
"params": { src: "/foo" }
},
// bar, get#foo-index
"bar": {
"path": "/bar",
"verbs": [ "get" ],
"call": "foo.index",
"params": { src: "/bar" }
}
}
//
// app.mojito.get('/foo', 'foo.index); // get#foo-index
// app.mojito.get('/bar', 'foo.index'); // get#foo-index
app: {
'/foo': {
name: 'get#foo-index',
names: [ 'get#foo-index' ]
},
'/bar': {
name: 'get#foo-index',
names: [ 'get#foo-index' ]
}
}
// what should this returned ?
ac.url.make('foo.index', 'get') ? "/foo" or "/bar" ?
ac.ur.make('foo.index', 'get', { src: '/foo' }) == '/foo' ?
255 libmethods.forEach(function (method) {
256 var dispatch = libdispatcher.dispatch.bind(libdispatcher),
257 key = Y.mojito.util.encodeRouteName;
258
259 app.mojito[method] = function (path, call) {
260 app.get.apply(app,
261 [path, dispatch(call)].concat([].slice.call(arguments, 2)));
262 app.map(path, key(method, call));
263 };
264 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment