1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-15 14:04:59 -05:00
kaiwa/server.js

55 lines
1.5 KiB
JavaScript
Raw Normal View History

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
},
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',
'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);