Skip to content

Instantly share code, notes, and snippets.

Created November 19, 2015 21:59
Show Gist options
  • Save anonymous/503da89311dd2e9fa9a6 to your computer and use it in GitHub Desktop.
Save anonymous/503da89311dd2e9fa9a6 to your computer and use it in GitHub Desktop.
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config.dev');
var fs = require('fs');
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
publicPath: config.output.publicPath,
noInfo: true
}));
app.use(require('webpack-hot-middleware')(compiler));
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, 'index.html'));
});
app.listen(3000, '0.0.0.0', function(err) {
if (err) {
console.log(err);
return;
}
console.log('Listening at http://localhost:3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment