all.js 609 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Module dependencies.
  3. */
  4. var cluster = require('../../')
  5. , should = require('should')
  6. , http = require('http')
  7. , fs = require('fs');
  8. require('../common');
  9. var server = http.createServer(function(req, res){
  10. setTimeout(function(){
  11. res.writeHead(200);
  12. res.end('Hello World');
  13. }, 1000);
  14. });
  15. cluster = cluster(server)
  16. .set('workers', 6)
  17. .use(cluster.pidfiles())
  18. .use(cluster.cli())
  19. .use(cluster.logger(__dirname + '/../logs'))
  20. .use(cluster.repl(8888, 'localhost'))
  21. .use(cluster.stats())
  22. .listen(3000);
  23. cluster.on('listening', function(){
  24. console.log('listening');
  25. });