我试图调用索引操作并继续调用计数操作,但我不知道原因。这是urlmapping
group "/api/product",{
"?"(controller: 'product', action: 'save', method: 'POST')
"?"(controller: 'product', action: 'index', method: 'GET')
"/$id?"(controller: 'product', action: 'delete', method: 'DELETE')
"/$id?"(controller: 'product', action: 'update', method: 'PUT')
"/$id?"(controller: 'product', action: 'show', method: 'GET')
"/count?"(controller: 'product', action: 'count', method: 'GET')
}
答案 0 :(得分:1)
尝试以下映射:
"/api/product/count"(controller:"product")
{
action = [GET:"count"]
}
"/api/product/$id"( controller:"product")
{
action = [GET: "show", PUT:"update",DELETE:"delete"]
}
"/api/product"( controller:"product")
{
action = [GET: "index", POST:"save"]
}