forked from regentmarkets-repo-archive/binary-next-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
41 lines (31 loc) · 1.02 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const config = require('./webpack.config');
const gutil = require('gulp-util');
// const Dashboard = require('webpack-dashboard');
// const DashboardPlugin = require('webpack-dashboard/plugin');
const app = express();
const compiler = webpack(config);
// const dashboard = new Dashboard();
// compiler.apply(new DashboardPlugin(dashboard.setData));
app.use(require('node-sass-middleware')({
src: path.join(__dirname, 'styles'),
dest: path.join(__dirname, 'www'),
}));
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: config.output.publicPath,
}));
app.use(require('webpack-hot-middleware')(compiler));
app.use('/', express.static('www'));
app.get('*', (req, res) =>
res.sendFile(path.join(__dirname, 'www/index.html'))
);
app.listen(3000, 'localhost', err => {
if (err) {
gutil.log(err);
return;
}
gutil.log('Listening at http://localhost:3000');
});