var seneca=require('seneca')()
seneca.add({cmd:'wordcount'},function(msg,respond){
var length=0;
if(msg.hasOwnProperty('phrase'))
length=msg.phrase.split(' ').length;
respond(null,{words:length});
});
seneca.act({cmd:'wordcount',phrase:'hello everybody! i love all of you!'},function(err,response){
if(err){
console.log('Error!');
return;
};
console.log(response);
});
seneca.act({cmd:'wordcount'},function(err,response){
if(err){
console.log(err);
return;
};
console.log(response);
});