diff --git a/server/index.js b/server/index.js deleted file mode 100644 index 0b15e81..0000000 --- a/server/index.js +++ /dev/null @@ -1,69 +0,0 @@ -import express from 'express'; -import React from 'react'; -import { renderToString } from 'react-dom/server'; -import { RoutingContext, match } from 'react-router'; -import { Provider } from 'react-redux'; -import { routes } from './src/components/Router'; -import store from '../src/store'; - -const app = express(); - -// 596957 -// 600232 - -function renderFullPage(html, initialState) { - return ` - - - - - RUARUA.LIVE - 全球直播聚合平台 - - - - - - -
- ${html} -
- - - - - - `; -} - -app.use((req, res) => { - match({ routes, location: req.url }, (err, redirectLocation, renderProps) => { - - if (err) { - res.status(500).end(`Internal Server Error ${err}`); - } else if (redirectLocation) { - res.redirect(redirectLocation.pathname + redirectLocation.search); - } else if (renderProps) { - - const state = store.getState(); - - Promise.all([ - store.dispatch(getMetadata()), - store.dispatch(getCategory()), - ]) - .then(() => { - const html = renderToString( - - - - ); - res.end(renderFullPage(html, store.getState())); - }); - } else { - res.status(404).end('Not found'); - } - }); -}); - -app.listen(8080) \ No newline at end of file