-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
32 lines (27 loc) · 861 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
31
32
const express = require('express');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config.js');
const app = express();
// var elasticsearch = require('elasticsearch');
// var client = new elasticsearch.Client({
// host: 'localhost: 9200',
// log: 'trace'
// });
const compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler, {
hot: true,
filename: 'bundle.js',
publicPath: '/',
state: {
colors: true,
},
historyApiFallback: true,
}));
app.use(require('webpack-hot-middleware')(compiler));
app.use(express.static(__dirname + '/client'));
const server = app.listen(3000, () => {
const host = server.address().address;
const port = server.address().port;
console.log('blog app listining at http://%s:%s', host, port);
});