![](/img/trans.png)
[英]Feathers js - how to get the data in config/default.json
[英]Feathers js how to customize get service endpoint
所以我想將 url 附加到我在另一個服務中的用戶請求中。 如何自定義獲取請求?
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)
}
}
您從super
中檢索值並返回一個新的 object:
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'
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.