Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #35 from rocjs/easier-to-overide-server
Browse files Browse the repository at this point in the history
Made it easier to take ownership over the server entry point
  • Loading branch information
andreasrs authored Oct 13, 2016
2 parents 86b481b + b07b6aa commit 4ac7684
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 1 addition & 8 deletions extensions/roc-package-web-app-react/app/default/server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import { createServer, useReact } from '../server';

import getRoutesAndStore from './get-routes-and-store';

const { store, routes } = getRoutesAndStore();

useReact(createServer)({
createRoutes: routes,
createStore: store,
}).start();
useReact(createServer)().start();
9 changes: 8 additions & 1 deletion extensions/roc-package-web-app-react/app/server/useReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import useReactLib from 'roc-package-web-app-react/lib/app/server/useReact';

import Header from '../shared/header';
import getRoutesAndStore from '../default/get-routes-and-store';

const { store, routes } = getRoutesAndStore();

export default function useReact(createServer) {
// eslint-disable-next-line
Expand All @@ -13,13 +16,17 @@ export default function useReact(createServer) {
reduxSagas = require(REDUX_SAGAS).default; // eslint-disable-line
}

return useReactLib(createServer, {
return ({ createRoutes = routes, createStore = store, ...rest } = {}) => useReactLib(createServer, {
dev: __DEV__,
dist: __DIST__,
hasTemplateValues: HAS_TEMPLATE_VALUES,
templateValues,
rocPath: ROC_PATH,
Header,
reduxSagas,
})({
createRoutes,
createStore,
...rest,
});
}

0 comments on commit 4ac7684

Please sign in to comment.