Sha256: 7c547c1b1a4175946c2a15ca27c1fce3748ea9cd90d03e23c502a20c035c60cd

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

var http = require('http');

var express = require('express');

var app = express();

app.use(require('morgan')('short'));

// ************************************
// This is the real meat of the example
// ************************************
(function() {

  // Step 1: Create & configure a webpack compiler
  var webpack = require('webpack');
  var webpackConfig = require('./webpack.config');
  var compiler = webpack(webpackConfig);

  // Step 2: Attach the dev middleware to the compiler & the server
  app.use(require("webpack-dev-middleware")(compiler, {
    noInfo: true, publicPath: webpackConfig.output.publicPath
  }));

  // Step 3: Attach the hot middleware to the compiler & the server
  app.use(require("webpack-hot-middleware")(compiler, {
    log: console.log, path: '/__webpack_hmr', heartbeat: 10 * 1000
  }));
})();

// Do anything you like with the rest of your express application.

app.get("/", function(req, res) {
  res.sendFile(__dirname + '/index.html');
});

if (require.main === module) {
  var server = http.createServer(app);
  server.listen(process.env.PORT || 1616, function() {
    console.log("Listening on %j", server.address());
  });
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
webpack_rails-2.0.1 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-2.0.0 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.3.1 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.3.0 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.2.2 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.2.1 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.2.0 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.1.1 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.1.0 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.0.1 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js
webpack_rails-1.0.0 lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js