10.2 Mapping to REST resources
If you prefer to keep the declaration of the URL mapping in your UrlMappings.groovy
file then simply removing the uri
attribute of the Resource
transformation and adding the following line to UrlMappings.groovy
will suffice:
"/books"(resources:"book")
Extending your API to include more end points then becomes trivial:
"/books"(resources:"book") {
"/publisher"(controller:"publisher", method:"GET")
}
The above example will expose the URI /books/1/publisher
.
A more detailed explanation on creating RESTful URL mappings can be found in the URL Mappings section of the user guide.