1
1
# hapi-react-router
2
2
3
- hapi route to delegate routing for html content to react-router
3
+ [ hapi] ( https://hapijs.com ) route to delegate routing for html content to react-router
4
4
5
- [ ![ npm] ( https://img.shields.io/npm/v/@travi/hapi-react-router.svg?maxAge=2592000 )] ( https://www.npmjs.com/package/@travi/hapi-react-router )
6
- [ ![ license] ( https://img.shields.io/github/license/travi/hapi-react-router.svg )] ( LICENSE )
7
5
[ ![ Build Status] ( https://img.shields.io/travis/travi/hapi-react-router.svg?style=flat&branch=master )] ( https://travis-ci.org/travi/hapi-react-router )
8
6
[ ![ Codecov] ( https://img.shields.io/codecov/c/github/travi/hapi-react-router.svg )] ( https://codecov.io/github/travi/hapi-react-router )
9
7
10
- [ ![ Commitizen friendly] ( https://img.shields.io/badge/commitizen-friendly-brightgreen.svg )] ( http://commitizen.github.io/cz-cli/ )
11
- [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
12
- [ ![ Greenkeeper badge] ( https://badges.greenkeeper.io/travi/hapi-react-router.svg )] ( https://greenkeeper.io/ )
8
+ ## Usage
13
9
14
- ## Installation
10
+ [ ![ npm] ( https://img.shields.io/npm/v/@travi/hapi-react-router.svg?maxAge=2592000 )] ( https://www.npmjs.com/package/@travi/hapi-react-router )
11
+ [ ![ license] ( https://img.shields.io/github/license/travi/hapi-react-router.svg )] ( LICENSE )
12
+
13
+ ### Installation
15
14
16
15
``` sh
17
16
$ npm install @travi/hapi-react-router -S
18
17
```
19
18
20
- ## Usage
19
+ ### Register with your [ Hapi ] ( https://hapijs.com ) v17 server
21
20
22
21
Include this plugin in the [ manifest] ( https://github.com/hapijs/glue ) of your
23
22
hapi application to direct all requests to ` /html ` to a server-side renderer
@@ -30,19 +29,16 @@ will be triggered and rendering will wait for all related requests to complete.
30
29
This enables populating the data store based on the components that are mounted
31
30
for the current route.
32
31
33
- :warning : [ a regenerator runtime] ( https://babeljs.io/docs/plugins/transform-regenerator/ )
34
- is required since this package leverages async functions
35
-
36
32
### Example
37
33
38
34
``` js
39
35
export default {
40
- connections : [ {port: 8090 }] ,
41
- registrations : [
42
- {plugin : ' @travi/hapi-html-request-router ' },
43
- {
44
- plugin : {
45
- register : ' @travi/hapi-react-router' ,
36
+ server : {port: process . env . PORT } ,
37
+ register : {
38
+ plugins : [
39
+ {plugin : ' @travi/hapi-html-request-router ' },
40
+ {
41
+ plugin : ' @travi/hapi-react-router' ,
46
42
options: {
47
43
respond : (reply , {renderedContent}) => {
48
44
reply .view (' layout' , {renderedContent});
@@ -63,8 +59,8 @@ export default {
63
59
configureStore : ({session}) => createStore (reducer, composeMiddlewares (session))
64
60
}
65
61
}
66
- }
67
- ]
62
+ ]
63
+ }
68
64
}
69
65
```
70
66
@@ -90,7 +86,11 @@ required.
90
86
so that your component can inject it into the context through a provider
91
87
component.
92
88
93
- ## Local Development
89
+ ## Contribution
90
+
91
+ [ ![ Commitizen friendly] ( https://img.shields.io/badge/commitizen-friendly-brightgreen.svg )] ( http://commitizen.github.io/cz-cli/ )
92
+ [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
93
+ [ ![ Greenkeeper badge] ( https://badges.greenkeeper.io/travi/hapi-react-router.svg )] ( https://greenkeeper.io/ )
94
94
95
95
### Install dependencies
96
96
0 commit comments