Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (40 sloc) 1.046 kb
c1b2f76 init
Jonathan Mumm authored
1 var express = require('express');
2
3 var app = module.exports = express.createServer();
4
06e5c25 Fixed production port
Jonathan Mumm authored
5 var port = 3000;
6 if (process.env.NODE_ENV === "production") {
7 port = 80;
8 }
b7ab920 Changed default port to 80 for prod
Jonathan Mumm authored
9
c1b2f76 init
Jonathan Mumm authored
10 // Configuration
911471a Changed to using jade templates
Jonathan Mumm authored
11 app.configure(function() {
c1b2f76 init
Jonathan Mumm authored
12 app.set('views', __dirname + '/views');
13 app.set('view engine', 'jade');
14 app.use(express.bodyParser());
15 app.use(express.methodOverride());
16 app.use(app.router);
17 app.use(express.static(__dirname + '/public'));
18 });
19
911471a Changed to using jade templates
Jonathan Mumm authored
20 app.configure('development', function() {
dc402c3 updated prod host
Jonathan Mumm authored
21 app.use(express.errorHandler({
22 dumpExceptions: true,
23 showStack: true
24 }));
c1b2f76 init
Jonathan Mumm authored
25 });
26
43b8946 Added production config back in
Jonathan Mumm authored
27 app.configure('production', function() {
28 app.use(express.errorHandler());
29 });
30
911471a Changed to using jade templates
Jonathan Mumm authored
31 // Routes
32 app.get('/', function(req, res) {
33 res.render('index', {
06e5c25 Fixed production port
Jonathan Mumm authored
34 title: 'RouletteTok'
911471a Changed to using jade templates
Jonathan Mumm authored
35 });
c1b2f76 init
Jonathan Mumm authored
36 });
37
38 if (!module.parent) {
b7ab920 Changed default port to 80 for prod
Jonathan Mumm authored
39 app.listen(port);
40 console.log("Server listening on port %d", port);
c1b2f76 init
Jonathan Mumm authored
41 }
42
dc402c3 updated prod host
Jonathan Mumm authored
43 // Start my Socket.io app and pass in the socket
2e25fc4 Updated socket.io to latest version
Jonathan Mumm authored
44 var io = require('socket.io').listen(app);
8f600aa Jonathan Mumm Changed the way partner sessions are disconnected because iOS does not h...
authored
45 io.configure(function() {
46 io.set('close timeout', 60*60*24);
47 });
48
2e25fc4 Updated socket.io to latest version
Jonathan Mumm authored
49 require('./socketapp').start(io.sockets);
Something went wrong with that request. Please try again.