forked from Peer5/ShareFest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
30 lines (25 loc) · 895 Bytes
/
server.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
var express = require('express');
var app = express();
var signaling = require('./server/lib/signalingServer.js');
var router = require('./server/lib/router.js')
var server;
var allowCrossDomain = function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Headers', 'Range');
next();
}
app.use(allowCrossDomain);
app.use(express.static(__dirname + '/public'));
app.configure('development', function () {
app.use(express.errorHandler({ dumpExceptions:true, showStack:true }));
console.log('listening to port 13337')
server = app.listen(13337);
signaling.start(server);
console.log('here I am');
});
app.configure('production', function () {
console.log('listening to port 80')
server = app.listen(80); //nodejitsu will map this to 80
signaling.start(server);
});
router.configure(app, __dirname);