« Back
Sammy.Application route ( verb, path )
route()
is the main method for defining routes within an application.
For great detail on routes, check out:
http://sammyjs.org/docs/routes
This method also has aliases for each of the different verbs (eg. get()
, post()
, etc.)
Arguments
verb
A String in the set of ROUTE_VERBS or 'any'. 'any' will add routes for each of the ROUTE_VERBS. If only two arguments are passed, the first argument is the path, the second is the callback and the verb is assumed to be 'any'.path
A Regexp or a String representing the path to match to invoke this verb.callback
A Function that is called/evaluated when the route is run see:runRoute()
. It is also possible to pass a string as the callback, which is looked up as the name of a method on the application.
comments powered by Disqus