To create a simple mapping simply use a relative URL as the method name and specify named parameters for the controller and action to map to:
"/product"(controller:"product", action:"list")
In this case we've mapped the URL
/product
to the
list
action of the
ProductController
. You could of course omit the action definition to map to the default action of the controller:
"/product"(controller:"product")
An alternative syntax is to assign the controller and action to use within a block passed to the method:
"/product" {
controller = "product"
action = "list"
}
Which syntax you use is largely dependent on personal preference. If you simply want to rewrite on URI onto another explicit URI (rather than a controller/action pair) this can be achieved with the following example:
"/hello"(uri:"/hello.dispatch")
Rewriting specific URIs is often useful when integrating with other frameworks.