Last active
December 22, 2015 16:49
-
-
Save imalberto/6501549 to your computer and use it in GitHub Desktop.
how to deal with this routes.json config with the updated scheme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| // 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' ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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