根据文档,我意识到有一个允许批量创建的选项,但我不知道在哪里以及如何设置该选项,这里是代码:
// Initializes the `test` service on path `/test`
const createService = require('feathers-sequelize');
const createModel = require('../../models/test.model');
const hooks = require('./test.hooks');
module.exports = function (app) {
const Model = createModel(app);
const paginate = app.get('paginate');
//Where to put the multi option???
const options = {
Model,
paginate
};
// Initialize our service with any options it requires
app.use('/test', createService(options));
// Get our initialized service so that we can register hooks
const service = app.service('test');
service.hooks(hooks);
};提前谢谢你。
发布于 2019-03-19 22:51:54
该选项将添加到options对象中:
// Initializes the `test` service on path `/test`
const createService = require('feathers-sequelize');
const createModel = require('../../models/test.model');
const hooks = require('./test.hooks');
module.exports = function (app) {
const Model = createModel(app);
const paginate = app.get('paginate');
//Where to put the multi option???
const options = {
Model,
paginate,
multi: [ 'create' ] // list of method names
// or for everything
// multi: true
};
// Initialize our service with any options it requires
app.use('/test', createService(options));
// Get our initialized service so that we can register hooks
const service = app.service('test');
service.hooks(hooks);
};https://stackoverflow.com/questions/55238079
复制相似问题