直接上图 还有 启动的时候 提示什么 notice
var express = require(‘express’), http = require(‘http’), socket = require(‘socket.io’), path = require(‘path’), fs = require(‘fs’), juicer = require(‘juicer’); juicer.set('strip’,false);
var app = express(), server = http.createServer(app), //你的错误应该是没有使用express3.0新的方法 io = socket.listen(server);
io.set('log level’, 0);
app.configure(function(){ app.set(‘env’,’production’); app.set('port’, process.env.PORT || 3000); app.set('views’, __dirname + ‘/views’); // app.set('view engine’, ‘jade’); app.set('view engine’, ‘html’); app.engine('html’, function(path, options, fn){ fs.readFile(path, 'utf8’, function(err, str){ if (err) return fn(err); str = juicer(str, options); fn(null, str); }); }); app.set('view options’, {layout: false}); app.use(express.favicon()); app.use(express.logger(‘dev’)); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser(‘your secret here’)); app.use(express.session()); app.use(require(‘less-middleware’)({ src: __dirname + ‘/public’ })); app.use(express.static(path.join(__dirname, ‘public’))); app.use(app.router); });
app.configure('development’, function(){ app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); });
app.configure('production’, function(){ app.use(express.errorHandler()); });
// Routes app.get('/news’,news.index);
server.listen(app.get(‘port’), function(){ console.log("Express server listening on port %d in %s mode", app.get(‘port’), app.get(‘env’)); });