-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
21 lines (18 loc) · 665 Bytes
/
app.js
File metadata and controls
21 lines (18 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const Server = require('./server.js');
const port = (process.env.PORT || 8080);
const app = Server.app();
if (process.env.NODE_ENV !== 'production') {
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const config = require('./webpack.dev.config.js');
const compiler = webpack(config)
app.use(webpackHotMiddleware(compiler));
app.use(webpackDevMiddleware(compiler, {
contentBase: '/public/',
noInfo: true,
publicPath: config.output.publicPath
}));
}
app.listen(port)
console.log(`Listening at http://localhost:${port}`)