Guest User

Untitled

a guest
Jul 6th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var config         = require('./config')
  2.   , express        = require('express')
  3.   , routes         = require('./routes')
  4.   , RedisStore     = require('connect-redis')(express)
  5.   , sessionStore   = new RedisStore(config.redis)
  6.   , app            = express.createServer();
  7.  
  8. app.configure(function () {
  9.   app.use(express.static(__dirname + '/public'));
  10.   app.use(express.cookieParser('keyboard cat'));
  11.   app.use(express.session({
  12.     secret: config.sessionSecret,
  13.     key: 'express.sid',
  14.     store: sessionStore
  15.   }));
  16.   app.use(express.bodyParser());
  17.   app.use(express.methodOverride());
  18.   app.use(app.router);
  19. })
  20.  
  21. app.configure('development', function () {
  22.   app.use(express.errorHandler());
  23. });
  24.  
  25. app.enable('jsonp callback');
  26.  
  27. routes.init(app);
  28.  
  29. app.listen(config.port);
  30. console.log("listening on port " + config.port);
  31.  
  32. // socket.io
  33. var io = require('socket.io').listen(app);
  34. io.configure(function() {
  35.         io.set("polling duration", 10);
  36.         io.enable('browser client minification');
  37.         io.enable('browser client etag');
  38.         io.enable('browser client gzip');
  39.         io.set('log level', 3);
  40.         io.set('transports', ['xhr-polling']);
  41.     }
  42. );
Advertisement
Add Comment
Please, Sign In to add comment