Skip to content

Commit

Permalink
refactored cli.js example
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 13, 2011
1 parent 2fb9645 commit c7b8855
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
13 changes: 13 additions & 0 deletions examples/cli-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

/**
* Module dependencies.
*/

var http = require('http');

module.exports = http.createServer(function(req, res){
console.log('%s %s', req.method, req.url);
var body = 'Hello World';
res.writeHead(200, { 'Content-Length': body.length });
res.end(body);
});
12 changes: 2 additions & 10 deletions examples/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
* Module dependencies.
*/

var cluster = require('../')
, http = require('http');

var server = http.createServer(function(req, res){
console.log('%s %s', req.method, req.url);
var body = 'Hello World';
res.writeHead(200, { 'Content-Length': body.length });
res.end(body);
});
var cluster = require('../');

// Launch the cluster:
// $ nohup node examples/cli.js &
Expand All @@ -22,7 +14,7 @@ var server = http.createServer(function(req, res){
// View other commands:
// $ node examples/cli.js --help

cluster(server)
cluster('cli-app')
.use(cluster.pidfiles())
.use(cluster.debug())
.use(cluster.cli())
Expand Down

0 comments on commit c7b8855

Please sign in to comment.