2013-08-20 13:45:06 -04:00
|
|
|
var express = require('express');
|
2013-08-29 23:38:28 -04:00
|
|
|
var helmet = require('helmet');
|
2013-08-20 13:45:06 -04:00
|
|
|
var Moonboots = require('moonboots');
|
|
|
|
var config = require('getconfig');
|
2013-08-29 23:38:28 -04:00
|
|
|
var templatizer = require('templatizer');
|
2013-06-03 18:51:30 -04:00
|
|
|
|
|
|
|
|
2013-08-29 23:38:28 -04:00
|
|
|
var app = express();
|
|
|
|
app.use(express.compress());
|
2013-06-03 18:51:30 -04:00
|
|
|
app.use(express.static(__dirname + '/public'));
|
2013-08-29 23:38:28 -04:00
|
|
|
if (!config.isDev) {
|
|
|
|
app.use(helmet.xframe());
|
|
|
|
}
|
|
|
|
app.use(helmet.iexss());
|
|
|
|
app.use(helmet.contentTypeOptions());
|
|
|
|
|
2013-06-03 18:51:30 -04:00
|
|
|
|
|
|
|
var clientApp = new Moonboots({
|
2013-08-29 23:38:28 -04:00
|
|
|
main: __dirname + '/clientapp/app.js',
|
2013-06-03 18:51:30 -04:00
|
|
|
developmentMode: config.isDev,
|
|
|
|
libraries: [
|
2013-08-29 23:38:28 -04:00
|
|
|
__dirname + '/clientapp/libraries/jquery.js',
|
|
|
|
__dirname + '/clientapp/libraries/sugar-1.2.1-dates.js',
|
|
|
|
__dirname + '/clientapp/libraries/IndexedDBShim.min.js',
|
|
|
|
__dirname + '/clientapp/libraries/stanza.io.js'
|
|
|
|
],
|
|
|
|
stylesheets: [
|
|
|
|
__dirname + '/public/style.css'
|
2013-06-03 18:51:30 -04:00
|
|
|
],
|
2013-08-29 23:38:28 -04:00
|
|
|
browserify: {
|
|
|
|
debug: false
|
|
|
|
},
|
|
|
|
server: app,
|
|
|
|
beforeBuild: function () {
|
|
|
|
var clientFolder = __dirname + '/clientapp';
|
|
|
|
templatizer(clientFolder + '/templates', clientFolder + '/templates.js');
|
|
|
|
}
|
2013-06-03 18:51:30 -04:00
|
|
|
});
|
|
|
|
|
2013-08-29 23:38:28 -04:00
|
|
|
|
2013-06-03 18:51:30 -04:00
|
|
|
// serves app on every other url
|
|
|
|
app.get('*', clientApp.html());
|
|
|
|
|
2013-08-29 23:38:28 -04:00
|
|
|
|
|
|
|
app.listen(config.http.port);
|
2013-08-20 13:45:06 -04:00
|
|
|
console.log('demo.stanza.io running at: ' + config.http.baseUrl);
|