forked from andrewagain/minimal-react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (23 loc) · 682 Bytes
/
server.js
File metadata and controls
27 lines (23 loc) · 682 Bytes
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
const express = require("express");
const webpackDevMiddleware = require("webpack-dev-middleware");
const webpack = require("webpack");
const webpackConfig = require("./webpack.config.js");
const app = express();
const compiler = webpack(webpackConfig);
app.use(
webpackDevMiddleware(compiler, {
hot: true,
filename: "bundle.js",
publicPath: "/",
stats: {
colors: true
},
historyApiFallback: true
})
);
app.use(express.static(__dirname + "/www"));
const server = app.listen(3000, function() {
const host = server.address().address;
const port = server.address().port;
console.log("Example app listening at http://%s:%s", host, port);
});