How to use the found/lib/createInitialFarceRouter function in found

To help you get started, we’ve selected a few found examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github damassi / isomorphic-relay-app / relay-modern-found / src / lib / isomorphic-relay / mountClient.js View on Github external
export async function mountClient(routeConfig) {
  const environment = createRelayEnvironment(
    JSON.parse(window.__RELAY_BOOTSTRAP__)
  ) // eslint-disable-line
  const historyMiddlewares = [queryMiddleware]
  const resolver = new Resolver(environment)
  const render = createRender({})

  try {
    const Router = await createInitialFarceRouter({
      historyProtocol: new BrowserProtocol(),
      historyMiddlewares,
      routeConfig,
      resolver,
      render,
    })

    Loadable.preloadReady().then(() => {
      ReactDOM.hydrate(
github damassi / isomorphic-relay-app / _found-relay / src / lib / relay / mountClient.js View on Github external
export async function mountClient(routeConfig) {
  const fetcher = new ClientFetcher(
    process.env.METAPHYSICS_BASE_URL,
    window.__RELAY_PAYLOADS__
  )
  const resolver = createResolver(fetcher)
  const render = createRender({})

  const Router = await createInitialFarceRouter({
    historyProtocol: new BrowserProtocol(),
    historyMiddlewares: [queryMiddleware],
    routeConfig,
    resolver,
    render,
  })

  ReactDOM.hydrate(
    ,
    document.getElementById('root')
  )
}
github velop-io / server / src / utils / Router.js View on Github external
export async function createClientRouter(resolver) {
  const historyProtocol = new BrowserProtocol();
  const Router = await createInitialFarceRouter({
    historyProtocol,
    historyMiddlewares,
    routeConfig: require(process.env.REACT_APP_PATH).default,
    resolver,
    render
  });

  return Router;
}