JavaScript Icon

fugue: Unicorn for node.js

Unicorn, the Unix-y Ruby web server has been growing in popularity lately.

Pedro Teixeira has released Fugue which brings the Unicorn concept to Node.js, mashed up with some ideas from Spark. On top of the Unicorn approach, Fugue gives your Node.js app things like zero downtime reloads and daemonization.

Fugue can be installed via npm.

npm install fugue

To use Fugue, call fugue.start instead of the usual Node listen:

var fugue = require('fugue'),
    net =   require('net');

var server = net.createServer(function(conn) {
  conn.end( + "Hello from worker "+fugue.workerId());

fugue.start(server, 4000, null, 2, {verbose : true});

Fugue can launch any Node app that inherits from net.Server. Fugue will save the master PID to a file so you can live reload your app with

kill -USR2 <PID>

Be sure and check the README for startup options including both Unix socket and TCP support.

[Source on GitHub].

0:00 / 0:00