npm install ruto- Handles all incoming requests with react-router.
- Supports Hapi and Connect/Express servers.
- 302 (redirect) and 404 (not found) are delegated to the server.
- Includes optional helpers for connecting routes to a redux store.
See examples, including hapi/express server and state/redux.
``javascript
import React from 'react';
import {RoutingContext} from 'react-router';
import {register} from 'ruto';
import {renderToString} from 'react-dom/server';
server.register({
options: {
handler: ({props, reply}) => {
const app = renderToString(
// See examples for universal state/redux techniques.
reply(
);
},
routes:
},
register
});
`Express middleware:
`javascript
import React from 'react';
import {RoutingContext} from 'react-router';
import {middleware} from 'ruto';
import {renderToString} from 'react-dom/server';app.use(middleware({
handler: ({props, reply}) => {
const app = renderToString( );
// See examples for universal state/redux techniques.
reply(
);
},
routes:
}));
`Developing a pull request:
$3
`bash
cd ~/ruto
npm run start
open http://localhost:3000
`$3
`bash
npm test
``