Skip to content
_gt3 edited this page Jul 17, 2017 · 5 revisions

Welcome to the ultra-router wiki!

Concepts

path key

String representation of a route or part of it. For example: "/new-cars/:year/:make/:model"

  • identifier: Part of a path key whose value is derived dynamically from the url. Useful in matching multiple urls or validating urls. For e.g. ":year"
  • literal: Part of a path key that always produces the same match - everything but identifiers in a path key.

spec

An object that identifies a route with one or more path keys, and an action to invoke on match.

Path keys in a spec will be evaluated from left to right. Path key at position 0 is known as primary path key. Primary path key must match succesfully for remaining path keys to be considered for matching.

A spec will either resolve or reject the request to match. No more than one spec can resolve during a match.

  • resolve: next or err will be called to resolve an exact match or a partial match, respectively. next is required, and will be used if err is not provided.
  • reject: failure, if provided, will be called if the spec did not resolve. Reject is issued after resolve.

matcher

Provides API methods for a specific route configuration, invoked at runtime by the container. match, prefixMatch, and toggle produce a matcher.

mismatcher

dispatch

settle

resolve/reject

Clone this wiki locally