0
使用Sails.js Generate创建API非常简单。获取this tutorial example,运行如何自动解析Sails.js路径上的模型属性?
curl -X GET http://localhost:1337/employee/1
回报
{
"id": 1,
"name": "John Smith",
"email" "[email protected]",
"empnum" "123",
"createdAt" "2015-10-25T19:25:16.559Z",
"updatedAt" "2015-10-25T19:25:16.559Z",
}
和
curl -X GET http://localhost:1337/employee/1?fields=name
将返回
{
"name": "John Smith"
}
不是传递一个字段数组,我怎么可以配置Sails.js到r esolve像子资源路径:
curl -X GET http://localhost:1337/employee/1/name