// Express requirements import path from 'path'; import fs from 'fs'; // React requirements import React from 'react'; import { renderToString } from 'react-dom/server'; import Helmet from 'react-helmet'; import { Provider } from 'react-redux'; import { StaticRouter } from 'react-router'; import { Frontload, frontloadServerRender } from 'react-frontload'; import Loadable from 'react-loadable'; // Our store, entrypoint, and manifest import createStore from '../src/store'; import App from '../src/app/app'; import manifest from '../build/asset-manifest.json'; // Some optional Redux functions related to user authentication import { setCurrentUser, logoutUser } from '../src/modules/auth'; // LOADER export default (req, res) => { /* A simple helper function to prepare the HTML markup. This loads: - Page title - SEO meta tags - Preloaded state (for Redux) depending on the current route - Code-split script tags depending on the current route */ const injectHTML = (data, { html, title, meta, body, scripts, state }) => { data = data.replace('', ``); data = data.replace(/