2 * STANDARD_RIFT_IO_COPYRIGHT
5 var express
= require('express');
6 var path
= require('path');
7 var httpProxy
= require('http-proxy');
8 var bodyParser
= require('body-parser');
9 var cors
= require('cors');
10 var session
= require('express-session');
11 var proxy
= httpProxy
.createProxyServer();
14 var isProduction
= process
.env
.NODE_ENV
=== 'production';
15 var port
= isProduction
? 8080 : 8888;
16 var publicPath
= path
.resolve(__dirname
, 'public');
20 //Routes for local development
21 var lpRoutes
= require('./routes.js');
23 app
.use(express
.static(publicPath
));
25 secret
: 'ritio rocks',
27 app
.use(bodyParser
.urlencoded({
30 app
.use(bodyParser
.json());
32 app
.use('/', lpRoutes
);
33 var bundle
= require('./server/bundle.js');
36 app
.all('/build/*', function (req
, res
) {
38 target
: 'http://localhost:8080'
43 proxy
.on('error', function(e
) {
44 console
.log('Could not connect to proxy, please try again...');
47 app
.listen(port
, function () {
48 console
.log('Server running on port ' + port
);