Permalink
Browse files

refactored cli.js example

  • Loading branch information...
1 parent 2fb9645 commit c7b88557bb04d354840ff63e2a0fe6c2be9db5b0 @tj tj committed Sep 13, 2011
Showing with 15 additions and 10 deletions.
  1. +13 −0 examples/cli-app.js
  2. +2 −10 examples/cli.js
View
@@ -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);
+});
View
@@ -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 &
@@ -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())

0 comments on commit c7b8855

Please sign in to comment.