koa-universal-relay-router
Koa middleware for Universal/Isomorphic React + Relay rendering and routing
Installation
npm i -S koa-universal-relay-router
or
yarn add koa-universal-relay-router
Usage
client.js
const environment = ;environment // Inject preloaded data from the server sideconst data = JSON;IsomorphicRelay // Find the root elementconst rootElement = document; // Use the same routes object as on the server
server.js
let app = appapp
Props
renderServer
Prop | Type | Description |
---|---|---|
routes |
react-routes |
Routes for naviation |
render |
function |
Function to render default client template |
networkLayer |
Relay NetworkLayer |
Send a custom Relay NetworkLayer into the router |
graphqlUrl |
string |
URI of the GraphQL API |