0.0.9 • Published 8 years ago

restify-webpack-middleware v0.0.9

Weekly downloads
85
License
ISC
Repository
github
Last release
8 years ago

Restify Webpack Middleware

Just a thin wrapper around Webpack Dev Middleware and Webpack Hot Middleware for use with Restify.

registerWebpackMiddleware()

registerWebpackMiddleware(restifyInstance, { compiler, webpackDevConfig, webpackHotConfig });

Pass the instance of your Restify server along with the compiled Webpack config and the standard configuration objects from both Dev and Hot Middlewares and presto/chango/whamo you'll have some hot-dev middleware action.

import restify from 'restify';
import webpack from 'webpack';
import registerWebpackMiddleware from 'restify-webpack-middleware';

import webpackConfig from './path/to/your/webpack.config';

const server = restify.createServer({ ... });

const compiler = webpack(webpackConfig);

const webpackDevConfig = {
  webpackConfig,
  publicPath: webpackConfig.output.publicPath,
};

const webpackHotConfig = {
  log: console.log,
  path: '/__webpack_hmr',
};

registerWebpackMiddleware(
  restifyApp,
  {
    compiler,
    webpackDevConfig,
    webpackHotConfig,
  }
);