content: import React from 'react';
  import { renderToStaticMarkup, renderToString } from 'react-dom/server';
  import { Provider } from 'react-redux';
  import { StaticRouter } from 'react-router';
  
  import App from 'components/App';
  import Document from 'components/Document';
  import { createStore } from 'services/redux/store';
  
  const router = (req, res) => {
      const context = {};
      const store = createStore();
  
      const html = renderToStaticMarkup(
          <Document initialState={store.getState()}>
              {
                  renderToString(
                      <StaticRouter context={context} location={req.url}>
                          <Provider store={store}>
                              <App />
                          </Provider>
                      </StaticRouter>
                  )
              }
          </Document>
      );
  
      if (context.url) {
          return res.redirect(context.url);
      }
  
      res.send(`<!DOCTYPE html>${html}`);
  };
  
  export default router;
  