DailyJS

Node Roundup: Clarinet, Sandbox, actionHero

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

frameworks JSON node modules parsing

Node Roundup: Clarinet, Sandbox, actionHero

Posted by Alex R. Young on .
Featured

frameworks JSON node modules parsing

Node Roundup: Clarinet, Sandbox, actionHero

Posted by Alex R. Young on .
You can send in your Node projects for review through our contact form or @dailyjs.

Clarinet

Clarinet (GitHub: dscape / clarinet, License: Apache 2.0/MIT, npm: clarinet) by Nuno Job is a streaming JSON parser. The parser is event-based, and since it's streaming it makes dealing with huge files possible. The author still recommends using JSON.parse for most tasks, however.

The announcement blog post linked to above has detailed performance analysis and more background on the project.

Sandbox

Sandbox (GitHub: gf3 / sandbox, npm: sandbox) by Gianni Chiappetta is a sandbox for Node. That means untrusted code can be run in a relatively safe environment. It comes with some useful features, including timeouts and error handling.

To execute code in a sandbox, the run method on a Sandbox instance must be used:

var s = new Sandbox()  
s.run( '1 + 1 + " apples"', function( output ) {  
  // output.result == "2 apples"
})

actionHero

actionHero (License: license.txt, npm: actionHero) by Evan Tahler is a transactional API framework for sockets and HTTP clients. Actions are defined for GET and POST requests, and they're constructed from simple objects decorated with metadata for documentation:

var action = {};  
action.name = "randomNumber";

action.description = "I am an API method which will generate a random number";  
action.inputs = {  
  "required" : [],
  "optional" : []
};
action.outputExample = {  
  randomNumber: 123
}

action.run = function(api, connection, next){  
  connection.response.randomNumber = Math.random();
  next(connection, true);
};

exports.action = action;  

The framework comes with MySQL support, Models are implemented using the Sequelize MySQL ORM library.

actionHero also supports "tasks", which are periodic actions performed by the server. Other features and example code can be found in the project's repository.