-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (24 loc) · 773 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var socket = require('./routes/socket.js');
var app = express();
var server = http.createServer(app);
/* Configuration */
app.set('views', __dirname + '/views');
app.use(express.static(__dirname + '/public'));
app.set('port', 3000);
if (process.env.NODE_ENV === 'development') {
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
}
/* Socket.io Communication */
var io = require('socket.io').listen(server);
io.sockets.on('connection', socket);
/* Start server */
server.listen(app.get('port'), function (){
console.log('Express server listening on port %d in %s mode', app.get('port'), app.get('env'));
});
module.exports = app;