server.js 449 B

1234567891011121314151617181920212223242526
  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', 2)
  17. .listen(3000);
  18. cluster.on('listening', function(){
  19. console.log('listening');
  20. });