How to use electrode-redux-router-engine - 9 common examples

To help you get started, we’ve selected a few electrode-redux-router-engine 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 electrode-samples / express-react-redux-webpack / src / server.js View on Github external
// hot module replacement is enabled in the development env
    webpackIsomorphicTools.refresh();
  }

  function hydrateOnClient() {
    res.send(`\n ${ReactDOM.renderToString()}`);
  }

  if (__DISABLE_SSR__) {
    hydrateOnClient();
    return;
  }

  const routes = getRoutes();

  const engine = new ReduxRouterEngine({ routes, createReduxStore});

  engine.render(req)
    .then((result) => {
      const html = result.html;
      res.send(`\n' ${ReactDOM.renderToString()}`);
    });
});
github electrode-samples / electrode-progressive-beer / server / views / index-view.jsx View on Github external
module.exports = (req) => {
  // For Warning: Material UI: userAgent should be supplied in the muiTheme context for server-side rendering
  global.navigator = global.navigator || {};
  global.navigator.userAgent = req.headers['user-agent'] || 'all';

  const app = req.server && req.server.app || req.app;
  if (!app.routesEngine) {
    // For Warning: Unknown prop `onTouchTap` on <button> tag.
    injectTapEventPlugin();
    app.routesEngine = new ReduxRouterEngine({routes, createReduxStore});
  }

  return app.routesEngine.render(req);
};
</button>
github electrode-io / electrode / samples / universal-react-node / src / server / views / index-view.jsx View on Github external
module.exports = req => {
  const app = (req.server && req.server.app) || req.app;
  if (!app.routesEngine) {
    //
    // not passing in routesHandlerPath to let the engine figure out
    // default dir by using APP_SRC_DIR/server/routes
    //
    app.routesEngine = new ReduxRouterEngine({ routes });
  }

  return app.routesEngine.render(req);
};
github electrode-io / electrode / packages / electrode-webpack-reporter / src / server / views / index-view.jsx View on Github external
module.exports = (req) => {
  const app = req.server && req.server.app || req.app;
  if (!app.routesEngine) {
    app.routesEngine = new ReduxRouterEngine({routes, createReduxStore});
  }

  return app.routesEngine.render(req);
};
github electrode-samples / hapi-react-redux / hapiApp / src / server.js View on Github external
*/
const store = configureStore({count: 100});
const initialState = store.getState();

function createReduxStore(request) {
  let initialState = {count : 100};
  let rootReducer = (s, a) => s;

  return Promise.all([
      Promise.resolve({})
    ]).then(() => {
      return store;
  });
}

const engine = new ReduxRouterEngine({ routes, createReduxStore});

/**
 * Start Hapi server
 */
var envset = {
  production: process.env.NODE_ENV === 'production'
};

const hostname = envset.production ? (process.env.HOSTNAME || process['env'].HOSTNAME) : "localhost";
var port = envset.production ? (process.env.PORT || process['env'].PORT) : 8000
const server = new Server();

server.connection({host: hostname, port: port});

server.register(
	[
github electrode-io / electrode-webpack-reporter / server / views / index-view.jsx View on Github external
module.exports = (req) => {
  const app = req.server && req.server.app || req.app;
  if (!app.routesEngine) {
    app.routesEngine = new ReduxRouterEngine({routes, createReduxStore});
  }

  return app.routesEngine.render(req);
};
github electrode-io / electrode / packages / generator-electrode / generators / webapp / templates / src / server / views / index-view.jsx View on Github external
module.exports = req => {
  if (!routesEngine) {
    routesEngine = new ReduxRouterEngine({ routes });
  }

  return routesEngine.render(req);
};
github electrode-io / electrode / samples / stylus-sample / src / server / views / index-view.jsx View on Github external
module.exports = req => {
  if (!routesEngine) {
    routesEngine = new ReduxRouterEngine({ routes });
  }

  return routesEngine.render(req);
};
github electrode-io / electrode / samples / hapi-app / src / server / views / index-view.jsx View on Github external
module.exports = req => {
  if (!routesEngine) {
    routesEngine = new ReduxRouterEngine({
      routes,
      webappPrefix: req.server.app.config.ui.webappPrefix
    });
  }

  return routesEngine.render(req);
};

electrode-redux-router-engine

Handle async data for React Server Side Rendering using Redux and Router

Apache-2.0
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Popular electrode-redux-router-engine functions