Skip to content

ui-router-server / ui-router-server / routeTrie

Variable: routeTrie ​

ts
const routeTrie: RouteIndex;

Defined in: route-trie.ts:261

The trie RouteIndex: hand it to `MountConfig.routeIndex` to resolve a 'matcher' mount by segment trie instead of a linear scan. Verdicts are the linear scan's. It throws at construction, naming each route it can't express: a case-insensitive url config, or a path param whose pattern may match a /.

Example ​

ts
import { createServerRouter, routeTrie } from 'ui-router-server';

const router = createServerRouter({
  mounts: {
    '/app': {
      routes: [{ name: 'home', url: '' }, { name: 'item', url: '/items/:id' }],
      routeIndex: routeTrie,
    },
  },
});