All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nucleus.UrlMappings.groovy Maven / Gradle / Ivy

Go to download

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
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy