I recently added the meteorhacks/npm package to my Meteor app so that I could utilize the Wordcount package within it.
Unfortunately, I'm encountering difficulties with my method implementation.
On the client-side:
getWordcount = function getWordcount(words, callback) {
Meteor.call('getWordcount', words, callback);
}
console.log(getWordcount('hello world')); // testing
On the server-side:
Meteor.methods({
'getWordcount': function getWordcount(words) {
var WordcountApi = Meteor.npmRequire('wordcount');
var wordcount = new WordcountApi({
version: "1.1.1"
});
var words = Async.runSync(function(done) {
wordcount.words, function(err, data) {
done(null, data);
}
});
return words.result;
}
});
The console is displaying an error message stating:
"Error invoking Method 'getWordcount': Internal server error [500]"