Skip to content

Instantly share code, notes, and snippets.

@sbruchmann
Created June 5, 2014 04:05
Show Gist options
  • Save sbruchmann/3c54c82975310d6bccb0 to your computer and use it in GitHub Desktop.
Save sbruchmann/3c54c82975310d6bccb0 to your computer and use it in GitHub Desktop.
Feathers.js bug: Service#create gets called twice
'use strict';
var feathers = require('feathers');
var rubberduck = require('rubberduck');
var tasks = [];
var emitter = rubberduck.emitter(tasks).punch('push');
emitter.on('beforePush', function(args, instance) {
console.log(new Date(), 'About to push ' + args[0]);
});
feathers()
.configure(feathers.rest())
.use('/tasks', {
create: function(data, params, done) {
console.log('create task');
tasks.push(data);
done(null, data);
}
})
.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment