-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
44 lines (35 loc) · 1.01 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
var connect = require('connect'),
sharejs = require('share'),
redis = require('redis');
var argv = require('optimist').
usage("Usage: $0 [-p portnum]").
default('p', 8000).
alias('p', 'port').
argv;
var server = connect(
connect.favicon(),
connect.static(__dirname + '/public'),
connect.router(function (app) {
app.get('/?', function(req, res, next) {
res.writeHead(302, {location: '/index.html'});
res.end();
});
})
);
var options = {
db: {type: 'redis'},
browserChannel: {cors: '*'}
};
console.log("Communico server starting");
console.log("Options: ", options);
var port = argv.p;
// Attach the sharejs REST and Socket.io interfaces to the server
sharejs.server.attach(server, options);
server.listen(port);
console.log("Running at http://localhost:" + port);
process.title = 'sharejs'
process.on('uncaughtException', function (err) {
console.error('An error has occurred.');
console.error('Version ' + sharejs.version + ': ' + err.stack);
});