10. Web Server
var connect = require('connect');
var app = connect();
app.use(connect.static("./public")));
app.use(connect.directory("./public"));
app.listen(8001);
console.log("Running at http://localhost:8001");
12年7月19日星期四
13. Node-Cluster
var cluster = require('node-cluster');
var master = new cluster.Master();
master.register(8080, 'app.js');
master.dispatch(); var cluster = require('node-cluster');
var worker = new cluster.Worker();
var connect = require('connect');
var app = connect();
app.use(connect.static("./public")));
app.use(connect.directory("./public"));
worker.ready(function (socket) {
app.emit('connection', socket);
});
12年7月19日星期四