receptor/serve.js
2017-08-06 18:23:54 -04:00

31 lines
715 B
JavaScript

var path = require('path');
var process = require('process');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config');
var mime = require('mime');
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));
app.use(require('webpack-hot-middleware')(compiler));
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, req.path));
});
var port = process.env.MANAGER_PORT || 3000;
app.listen(port, 'localhost', function(err) {
if (err) {
console.log(err);
return;
}
console.log('Listening at http://localhost:' + port);
});