-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
30 lines (25 loc) · 811 Bytes
/
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
var express = require('express');
var app = express();
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
app.get('/app.js', function (req, res) {
res.redirect('//localhost:9090/build/app.js');
});
app.get('/', function (req, res) {
res.sendFile(__dirname + '/build/index.html');
});
app.use(express.static(__dirname + '/build/stylesheets'));
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
noInfo: true,
historyApiFallback: true
}).listen(9090, 'localhost', function (err, result) {
if (err) {
console.log(err);
}
});
var server = app.listen(8080, function () {
console.log('Listening at http://localhost:%s', server.address().port);
});