nucleus.UrlMappings.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nucleus Show documentation
Show all versions of nucleus Show documentation
nucleus is a Grails-Groovy plugin which contains utility methods, classes and endpoints.
The newest version!
package nucleus
/**
* Defines default url mappings for Nucleus Plugin
*/
class UrlMappings {
static mappings = {
'/' (uri: '/ng/app/index.html')
"/api/$controller/$resourceId?/$customAction?" {
action = {
Map actionMethodMap = [GET: params.resourceId ? 'show' : 'index', POST: 'save',
PUT: 'update', DELETE: 'delete']
return params.customAction ?: actionMethodMap[request.method.toUpperCase()]
}
id = {
if (params.resourceId == 'action') {
return params.id
}
return params.resourceId
}
}
}
}