2015-10-29 08:33:21 +03:00
|
|
|
process.env.UV_THREADPOOL_SIZE = Math.ceil(Math.max(4, require('os').cpus().length * 1.5));
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
const express = require('express');
|
2015-10-23 21:02:42 +03:00
|
|
|
const webpack = require('webpack');
|
2015-10-26 12:47:53 +03:00
|
|
|
const config = require('./webpack.config.development');
|
2015-10-23 21:02:42 +03:00
|
|
|
|
2015-10-29 08:33:21 +03:00
|
|
|
const app = express();
|
|
|
|
const compiler = webpack(config);
|
|
|
|
|
|
|
|
app.use(require('webpack-dev-middleware')(compiler, {
|
2015-10-23 21:02:42 +03:00
|
|
|
publicPath: config.output.publicPath,
|
|
|
|
stats: {
|
|
|
|
colors: true
|
|
|
|
}
|
2015-10-29 08:33:21 +03:00
|
|
|
}));
|
|
|
|
|
|
|
|
app.use(require('webpack-hot-middleware')(compiler));
|
|
|
|
|
|
|
|
app.get('*', (req, res) => {
|
|
|
|
res.sendFile(path.join(__dirname, './www/index.html'));
|
|
|
|
});
|
|
|
|
|
|
|
|
app.listen(8081, '0.0.0.0', (err) => {
|
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('Listening at http://0.0.0.0:8081');
|
2015-10-23 21:02:42 +03:00
|
|
|
});
|