You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2020. It is now read-only.
Pass in an optional JavaScript object as options to the react-engine's [server engine create method](#setup-in-an-express-app).
74
-
The options object can contain properties from [react router's create configuration object](https://github.com/reactjs/react-router/blob/0.13.x/doc/02%20Top-Level/Router.create.md).
73
+
Pass in a JavaScript object as options to the react-engine's [server engine create method](#setup-in-an-express-app).
74
+
The options object should contain the mandatory `routes` property with the route definition.
75
75
76
76
Additionally, it can contain the following **optional** properties,
77
77
@@ -126,10 +126,9 @@ var data = client.data();
126
126
127
127
###### Client options spec
128
128
Pass in a JavaScript object as options to the react-engine's client boot function.
129
-
The options object can contain properties from [react router's create configuration object](https://github.com/reactjs/react-router/blob/0.13.x/doc/02%20Top-Level/Router.create.md).
130
-
131
-
Additionally, it can contain the following properties,
- `viewResolver` : **required** - _Function_ - a function that react-engine needs to resolve the view file.
134
133
an example of the viewResolver can be [found here](https://github.com/paypal/react-engine/blob/ecd27b30a9028d3f02b8f8e89d355bb5fc909de9/examples/simple/public/index.js#L29).
135
134
- `mountNode` : **optional** - _HTMLDOMNode_ - supply a HTML DOM Node to mount the server rendered component in the case of partial/non-full page rendering.
@@ -155,7 +154,7 @@ Note: By default, the following three keys are always filtered out from `renderO
155
154
- `_locals`
156
155
157
156
### Handling redirects and route not found errors on the server side
158
-
While using react-router, it matches the url to a component based on the app's defined routes. react-engine captures the redirects and not-found cases that are encountered while trying to run the react-router's [match function on the server side](https://github.com/react/react-router/blob/5590516ec228765cbb176c81fb15fe1d4662e475/docs/guides/advanced/ServerRendering.md).
157
+
While using react-router, it matches the url to a component based on the app's defined routes. react-engine captures the redirects and not-found cases that are encountered while trying to run the react-router's [match function on the server side](https://github.com/reactjs/react-router/blob/master/docs/guides/ServerRendering.md).
159
158
160
159
To handle the above during the lifecycle of a request, add an error type check in your express error middleware. The following are the three types of error that get thrown by react-engine:
161
160
@@ -227,7 +226,7 @@ var engine = require('react-engine').server.create({
227
226
* [Blog on react-engine](https://www.paypal-engineering.com/2015/04/27/isomorphic-react-apps-with-react-engine/)
228
227
229
228
### Migration from 2.x to 3.x
230
-
While upgrading to 3.x version of react-engine, make sure to follow the [react-router's 1.x upgrade guide](https://github.com/react/react-router/blob/5590516ec228765cbb176c81fb15fe1d4662e475/upgrade-guides/v1.0.0.md) to upgrade react-router related code in your app.
229
+
While upgrading to 3.x version of react-engine, make sure to follow the [react-router's 2.x upgrade guide](https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md) to upgrade react-router related code in your app.
231
230
Then, add to your express error middleware, react-engine's MATCH_REDIRECT and MATCH_NOT_FOUND checks.
0 commit comments