javascript - Find the list of defined sammy.js routes -
sammy.js controller library in javascript. have 404 because our route doesn't seems valid sammy.
how know route defined sammy.js in page ?
something ruby on rails' rake routes
.
like answers can search on app.routes. have in coffee script :
jquery.each app.routes, (r) -> console.log(json.stringify(r)) jquery.each app.routes[r], (u) -> console.log(json.stringify(u))
or in js
jquery.each(app.routes, function(r) { console.log(json.stringify(r)); return jquery.each(app.routes[r], function(u) { return console.log(json.stringify(u)); }); });
but it's not output routes have in output :
"get" 0 1 "post" 0 1 2 etc...
so code ?
you can try that
var app = $.sammy.apps['body']; jquery.each(app.routes, function(verb, routes) { jquery.each(routes, function(i, route) { console.log(route.verb, route.path); }); });
Comments
Post a Comment