MCPcopy Create free account
hub / github.com/TanStack/router / getRouter

Function getRouter

packages/start-server-core/src/createStartHandler.ts:452–482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

450
451 // Memoized router getter
452 const getRouter = async (): Promise<AnyRouter> => {
453 if (router) return router
454
455 router = await entries.routerEntry.getRouter()
456
457 let isShell = IS_SHELL_ENV
458 if (IS_PRERENDERING && !isShell) {
459 isShell = request.headers.get(HEADERS.TSS_SHELL) === 'true'
460 }
461
462 const history = createMemoryHistory({
463 initialEntries: [href],
464 })
465
466 router.update({
467 history,
468 isShell,
469 isPrerendering: IS_PRERENDERING,
470 origin: router.options.origin ?? origin,
471 ...{
472 defaultSsr: requestStartOptions.defaultSsr,
473 serializationAdapters: [
474 ...requestStartOptions.serializationAdapters,
475 ...(router.options.serializationAdapters || []),
476 ],
477 },
478 basepath: ROUTER_BASEPATH,
479 })
480
481 return router
482 }
483
484 // Check for server function requests first (early exit)
485 if (SERVER_FN_BASE && url.pathname.startsWith(SERVER_FN_BASE)) {

Callers 3

executeRouterFunction · 0.70
handleRedirectResponseFunction · 0.70
handleServerRoutesFunction · 0.70

Calls 3

createMemoryHistoryFunction · 0.90
getMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected