DailyJS

Node Roundup: npm 1.0, brain, nTunes, everyauth

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

audio node modules npm authentication

Node Roundup: npm 1.0, brain, nTunes, everyauth

Posted by Alex R. Young on .
Featured

audio node modules npm authentication

Node Roundup: npm 1.0, brain, nTunes, everyauth

Posted by Alex R. Young on .

npm 1.0

npm 1.0 is out, and Isaac Schlueter has written a short but sweet post about it on the Node blog: npm 1.0:
Released
. This
release nicely coincides with JSConf.

My Node tutorial part
23
has some tips for
using npm 1.0 -- I explain how global modules work. I'm convinced this
change in global module management will encourage people to write more
maintainable packages, so I hope 1.0 gets traction.

brain

brain (GitHub: harthur / brain, MIT License) by Heather Arthur
is a machine learning library for neural networks and Bayesian
classifiers. Bayesian classifiers have been famously used for spam
filters, which is illustrated by Heather's example:

var options = {
  backend: {
    type: 'localStorage',
    options: {
      name: 'emailspam' 
    } 
  }
};

var bayes = new brain.BayesianClassifier(options);
bayes.train('buy these great watches', 'spam', callback);

Look familiar?

It can be installed with npm install brain, and it'll even
work in browsers.

nTunes

nTunes (MIT License) by Nathan Rajlich is a REST API for controlling iTunes. There's an npm package,
but you might want to install this globally: npm install -g
nTunes
. Once it's installed and you've run nTunes,
it can be used like this:

~$ nTunes
          ______                                     
         /\__  _\                                    
  ___    \/_/\ \/   __  __    ___       __     ____  
/' _ `\     \ \ \  /\ \/\ \ /' _ `\   /'__`\  /',__\ 
/\ \/\ \     \ \ \ \ \ \_\ \/\ \/\ \ /\  __/ /\__, `\
\ \_\ \_\     \ \_\ \ \____/\ \_\ \_\\ \____\\/\____/
 \/_/\/_/      \/_/  \/___/  \/_/\/_/ \/____/ \/___/
  v0.1.0
          HTTP Server started on port: 8888
     Type 'help' for a list of runtime commands...

curl localhost:8888/current%20track/name
// "Tres Brujas"

curl -d value=50 localhost:8888/sound%20volume
// Volume changed to 50

everyauth

I haven't tried everyauth yet,
but it looks fairly painless to use. The author, Brian Noguchi, includes
an example Express
app
, and it
looks like everyauth takes a lot less configuration than other oauth
libraries I've worked with before.

For example:

everyauth
  .twitter
    .myHostname('http://local.host:3000')
    .consumerKey(conf.twit.consumerKey)
    .consumerSecret(conf.twit.consumerSecret)
    .findOrCreateUser( function (sess, accessToken, accessSecret, twitUser) {
      return usersByTwitId[twitUser.id] || (usersByTwitId[twitUser.id] = twitUser);
    })
    .redirectPath('/');

This library hides the complexity of OAuth nicely, which is good because
trying to deal with OAuth and OpenID is not exactly fun.