Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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()}`);
});
});
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>
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);
};
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);
};
*/
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(
[
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);
};
module.exports = req => {
if (!routesEngine) {
routesEngine = new ReduxRouterEngine({ routes });
}
return routesEngine.render(req);
};
module.exports = req => {
if (!routesEngine) {
routesEngine = new ReduxRouterEngine({ routes });
}
return routesEngine.render(req);
};
module.exports = req => {
if (!routesEngine) {
routesEngine = new ReduxRouterEngine({
routes,
webappPrefix: req.server.app.config.ui.webappPrefix
});
}
return routesEngine.render(req);
};