[英]Adding custom action when blueprint.rest=true in sailsjs
I only have blueprint.rest = true. 我只有blueprint.rest = true。 All others are disabled. 其他所有人都被禁用。 I like the rest=true because it restricts the GET/POST/PUT appropriately for find/update/destroy/create. 我喜欢rest = true,因为它适当地限制了GET / POST / PUT的查找/更新/销毁/创建。
But I would like to add another action in the controller which would do be something like 但是我想在控制器中添加另一个动作,就像
PUT /mycontroller/:id/validate PUT / mycontroller /:id / validate
You can add this static route in the config/routes.js
file. 您可以在config/routes.js
文件中添加此静态路由。
"PUT /yourcontroller/:id/validate" : { “ PUT /您的控制器/:id / validate”:{
controller : 'YourController', action: 'yourAction', }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.