2013-06-03 18:51:30 -04:00
|
|
|
/*global console*/
|
2013-08-20 13:45:06 -04:00
|
|
|
var fs = require('fs');
|
|
|
|
var privateKey = fs.readFileSync('fakekeys/privatekey.pem').toString();
|
|
|
|
var certificate = fs.readFileSync('fakekeys/certificate.pem').toString();
|
|
|
|
var express = require('express');
|
|
|
|
var app = express();
|
|
|
|
var server = require('https').createServer({key: privateKey, cert: certificate}, app);
|
|
|
|
var connect = require('connect');
|
|
|
|
var RedisStore = require('connect-redis')(connect);
|
|
|
|
var https = require('https');
|
|
|
|
var Moonboots = require('moonboots');
|
|
|
|
var config = require('getconfig');
|
|
|
|
var semiStatic = require('semi-static');
|
|
|
|
var uuid = require('node-uuid');
|
2013-06-03 18:51:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
app.use(express.static(__dirname + '/public'));
|
|
|
|
app.enable('trust proxy');
|
|
|
|
app.set('view engine', 'jade');
|
|
|
|
app.use(express.bodyParser());
|
|
|
|
app.use(express.cookieParser());
|
|
|
|
app.use(express.session({
|
|
|
|
proxy: true,
|
|
|
|
secret: config.session.secret,
|
|
|
|
store: new RedisStore({
|
|
|
|
host: config.session.host,
|
|
|
|
port: config.session.port,
|
|
|
|
db: config.session.db
|
|
|
|
}),
|
|
|
|
cookie: {
|
|
|
|
maxAge: 1000 * 60 * 60 * 24 * 90, // 90 days
|
|
|
|
secure: config.session.secure
|
|
|
|
},
|
2013-06-04 18:38:51 -04:00
|
|
|
key: 'o.im'
|
2013-06-03 18:51:30 -04:00
|
|
|
}));
|
|
|
|
|
|
|
|
var clientApp = new Moonboots({
|
2013-08-20 13:45:06 -04:00
|
|
|
fileName: 'stanzaiodemo',
|
2013-06-03 18:51:30 -04:00
|
|
|
dir: __dirname + '/clientapp',
|
|
|
|
developmentMode: config.isDev,
|
|
|
|
libraries: [
|
|
|
|
'jquery.js',
|
2013-06-03 19:41:02 -04:00
|
|
|
'stanza.io.js',
|
2013-08-20 13:45:06 -04:00
|
|
|
'sugar-1.2.1-dates.js',
|
2013-06-03 18:51:30 -04:00
|
|
|
'init.js'
|
|
|
|
],
|
|
|
|
server: app
|
|
|
|
});
|
|
|
|
|
|
|
|
// serves app on every other url
|
|
|
|
app.get('*', clientApp.html());
|
|
|
|
|
|
|
|
server.listen(config.http.port);
|
2013-08-20 13:45:06 -04:00
|
|
|
console.log('demo.stanza.io running at: ' + config.http.baseUrl);
|