Add routing for SSR

This commit is contained in:
Tom Raithel
2017-02-20 12:44:27 +01:00
parent 4fd02cc52e
commit 6cfd53a47a
9 changed files with 204 additions and 116 deletions

View File

@@ -11,7 +11,7 @@ import {
(async () => {
try {
const radar = await createRadar();
renderApp(radar, 'index');
renderApp(radar);
// outputRadar(radar);
// const radarByQuadrants = groupByQuadrants(radar);

View File

@@ -11,7 +11,21 @@ const appReducer = (state = {}, action) => {
return state;
}
export const renderApp = (radar, pageName) => {
const getPageNames = (radar) => {
return [
'index',
'overview',
'help',
'foo/bar',
]
}
export const renderApp = (radar) => {
const pageNames = getPageNames(radar);
pageNames.map(pageName => renderPage(radar, pageName))
}
export const renderPage = (radar, pageName) => {
// Create a new Redux store instance
const store = createStore(appReducer, {
...radar,