Bumper New Year Node Roundup

05 Jan 2011 | By Alex Young | Tags node server games

Welcome to the Node Roundup. Send in your apps and libraries using our contact form or @dailyjs.

I’ve received a huge amount of links about Node projects recently, so if your project isn’t in the roundup this week it’ll appear soon!

Node 0.3.3

Node 0.3.3 has been released:

  • V8 is now at 3.0.4
  • There’s now more operating system support for functions like os.cpus(), os.freemem(), os.totalmem(), os.loadavg()
  • process.stdin is now used instead of rocess.openStdin()
  • Lots of TLS improvements

I noticed @ryah link to this HTTPS API example which looks very easy to use.

Node.js Camp Videos

I also noticed @ryah link to these Node.js Camp videos with talks from Tom Hughes-Croucher, Ryan Dahl, Isaac Schlueter, Guillermo Rauch, Tim Caswell, and Matt Ranney.

The videos are even available at 1080p, so you can recreate the event in your living room at full HD!

n

n is a new project by TJ Holowaychuk for managing Node binaries. It looks very simple indeed:

npm install n
n 0.2.6
# The 'v' is optional
n v0.3.3
n 0.2.6 --debug --oprofile

Also worth noting:

To alter where n operates simply export N_PREFIX to whatever you prefer.

Given the name of this project I can only assume that TJ got tired of typing nvm. Actually, the difference between this project and nvm is that it requires less setup and doesn’t set environmental variables for the active node version but instead manipulates the file system. It can also accept ./configure options for each Node version (just pass the flags after the version).

jspp

jspp (GitHub: mikeal / jspp, Apache License 2.0), or JavaScript Pre-Processor, is a project by Mikeal Rogers that makes Node work a bit like PHP.

People on Twitter seemed to interpret this as a joke, but it really does remind me of PHP:

<html>
  <body>
    <div class="test1">
      <?jspp $(this).text("This is server side!"); end(); ?>
    </div>
    </body>
</html>

However, it can also use script tags of content type application/jspp — combining this with support for jQuery makes scripts that really blur the line between server-side software and client-side code.

I actually believe this is an interesting project with a large variety of use cases. Rather than encouraging people to write scrappy projects that mix code with markup, it could be a killer app for those smaller projects you don’t want a whole application environment. Think contact forms and low budget client projects.

node-crontab

node-crontab (GPL) by Blagovest Dachev provides an API for reading and editing user crontabs, which might fit nicely into your deployment system.

The API is asynchronous with callbacks:

require('crontab').load(cronLoaded);

function cronLoaded(err, tab) {
    if (err) { console.log(err); process.exit(1); }

    var command = '/usr/bin/env echo "starting some service..."';
    tab.remove(tab.findCommand(command));

    var item = tab.create(command);
    item.everyReboot();
    tab.save(cronSaved);
}

function cronSaved(err, tab) {
    if (err) { console.log(err); process.exit(1); }

    console.log('saved');
}

The author said it can be used to turn a script into a daemon:

It allows you to set a program to run even after the original process is terminated. Since cron has a special @reboot slot it makes a great addition to “forever”: your program becomes a true daemon.

Real-time Snowball Fights in Node

Mario Gonzalez wrote in with a game his team have built using Node and WebSockets: Ogilvy & Mather Holiday Snowball Fight. It’s a multiplayer game that uses a lot of interesting libraries, like CAAT and BiSON. The developers even say they based the multiplayer design on Valve’s Source Multiplayer Networking papers.

The game-engine, collision and logic run on the server in JavaScript running on Node.js. The clients are simply rendering information sent from the server, and sending off keyboard input.


blog comments powered by Disqus