-
config/blueprints.js
中的populate:填充开关
/***************************************************************************
* *
* Whether the blueprint controllers should populate model fetches with *
* data from other models which are linked by associations *
* If you have a lot of data in one-to-many associations, leaving this on *
* may result in very heavy api calls *
***************************************************************************/
populate: false
该参数控制blueprint controllers是否应该用其他关联model中的数据来填充model。如果在一对多的关联中有大量的数据,这将导致非常沉重的api调用,故默认为false,全局restful接口调用不填充。
-
config/route.js
中的restful接口设置,populate:true可跳过全局不填充设置,单独接口调用可以用关联model数据填充
/**
* 店员获取接收的信息
*/
'GET /msgToShop/getReceiveMessage': [
{policy: 'isAuth'},//鉴权
{policy: 'queryByUser'},//鉴权
{blueprint: 'find', model: 'msgtoshop', populate: true}
]
-
数据返回实例
restful接口返回 对应数据库msgtoshop表中数据
数据库中数据