让我们说,我们有一套铁路网应用程序,可以提供若干资源。
- tags
- urls
- users
The application has a classical web-interface which the users interact with and some administration. We want to expose the resources from the application to clients via a RESTful API and we don t want that part of the app to clutter up the controllers and code we already have. So we came up with the following:
如果网络接口提供<条码>>>/应用_path/url/[>>>>,[>>><>>>>>,我们希望《区域环境评估》的预报在<条码>/>上登上<>。
因此,我们最后收到以下乌拉尔马夫案:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
}
/* adding new urls and listing them */
"/rest/url"{
controller = "urlRest"
action = [POST: "save", PUT: "save", GET: "list", DELETE:"error"]
}
/* accessing a single url */
"/rest/url/$id"{
controller = "urlRest"
action = [POST: "update", PUT: "update", GET: "show", DELETE: "delete"]
}
/* non-crud stuff on urls */
"/rest/url/$action?/$id?"{
controller = "urlRest"
}
"/"(view:"/index")
"500"(view: /error )
}
}
问题是,这恰恰是南盟在此做的事情。 随着我们增加更多的资源,如标签,情况更加糟糕。 它们将转化为另外三个非常相似的法典。
非审慎职能将像寻找具体标准,这样......
我们尝试用一种 lo子,但没有成功,来绘制地图。 我们是否完全走在错误的道路上?