因此,我想将一个url附加到我的用户请求中,它在另一个服务中。如何定制get请求?
const { Service } = require('feathers-sequelize')
exports.Users = class Users extends Service {
get(id, params) {
// how to add custom data into to the get result?
return super.get(id, params)
}
}发布于 2022-07-02 21:26:23
从super检索值并返回一个新对象:
const { Service } = require('feathers-sequelize')
exports.Users = class Users extends Service {
async get(id, params) {
// how to add custom data into to the get result?
const data = await super.get(id, params)
return {
...data,
// when using raw: false:
// ...data.toJSON(),
message: 'New data here'
}
}
}https://stackoverflow.com/questions/72824849
复制相似问题