1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/server.js

38 lines
921 B
JavaScript
Raw Normal View History

var logger = require('./lib/logger');
2016-05-01 18:20:10 +02:00
var config = {
baseUriPath: process.env.BASE_URI_PATH || '',
port: process.env.HTTP_PORT || process.env.PORT || 4242
};
var app = require('./app')(config);
var server = app.listen(app.get('port'), function() {
logger.info('unleash started on ' + app.get('port'));
});
2016-05-01 18:20:10 +02:00
if (app.get('env') === 'development') {
app.use(require('errorhandler')());
var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackConfig = require('./webpack.config');
var compiler = webpack(webpackConfig);
app.use(config.baseUriPath, webpackDevMiddleware(compiler, {
publicPath: '/js',
noInfo: true
}));
}
process.on('uncaughtException', function(err) {
logger.error('Uncaught Exception:', err.message);
logger.error(err.stack);
});
module.exports = {
app: app,
server: server
};