MCPcopy
hub / github.com/TanStack/router / getRouter

Function getRouter

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

Source from the content-addressed store, hash-verified

467
468 // Memoized router getter
469 const getRouter = async (): Promise<AnyRouter> => {
470 if (router) return router
471
472 router = await entries.routerEntry.getRouter()
473
474 let isShell = IS_SHELL_ENV
475 if (IS_PRERENDERING && !isShell) {
476 isShell = request.headers.get(HEADERS.TSS_SHELL) === 'true'
477 }
478
479 const history = createMemoryHistory({
480 initialEntries: [href],
481 })
482
483 router.update({
484 history,
485 isShell,
486 isPrerendering: IS_PRERENDERING,
487 origin: router.options.origin ?? origin,
488 ...{
489 defaultSsr: requestStartOptions.defaultSsr,
490 serializationAdapters: [
491 ...requestStartOptions.serializationAdapters,
492 ...(router.options.serializationAdapters || []),
493 ],
494 },
495 basepath: ROUTER_BASEPATH,
496 })
497
498 return router
499 }
500
501 // Check for server function requests first (early exit)
502 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