How to use the hops-express.utils function in hops-express

To help you get started, we’ve selected a few hops-express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xing / hops / packages / build / lib / server.js View on Github external
'use strict';

var express = require('express');

var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackHotMiddleware = require('webpack-hot-middleware');

var hopsConfig = require('hops-config');
var hopsBuildConfig = require('hops-build-config');
var hopsExpressUtils = require('hops-express').utils;

var createMiddleware = require('./middleware');
var cleanup = require('./cleanup');

var developConfig = hopsBuildConfig.develop;
var nodeConfig = hopsBuildConfig.node;

process.on('unhandledRejection', function(error) {
  throw error;
});

function runDevelop(options, callback) {
  var compiler = webpack(developConfig);
  var app = express();
  app.use(hopsExpressUtils.timings);
  app.use(
github xing / hops / packages / build / lib / renderer.js View on Github external
'use strict';

var events = require('events');

var express = require('express');
var mocks = require('node-mocks-http');

var hopsConfig = require('hops-config');
var hopsExpressUtils = require('hops-express').utils;

var createMiddleware = require('./middleware');

module.exports = function createRenderer(webpackConfig, watchOptions) {
  var router = new express.Router();
  router.use(hopsExpressUtils.timings);
  hopsExpressUtils.bootstrap(router, hopsConfig);
  hopsExpressUtils.registerMiddleware(
    router,
    createMiddleware(webpackConfig, watchOptions)
  );
  return function(options) {
    if (typeof options === 'string') {
      options = { url: options };
    }
    return new Promise(function(resolve, reject) {