Optional
metadataExtracted metadata if RouteWithMetadata
was provided.
The path part of the route to match against, including the pathname but excluding query strings.
Optional
protocolThe protocol part of the route. Can be either https:
or http
.
If undefined, the route matches any protocol.
The original route string that was parsed to create this Route object. Contains the full route pattern as originally provided, including any protocols, wildcards, hostnames, and paths. Used for reference and sorting when routes have equal specificity.
Optional
specificityA numeric value representing how specific this route is for matching purposes. Higher values indicate more specific routes. Calculated as (hostScore * 26 + pathScore) where hostScore is the number of hostname parts (subdomains) and pathScore is the number of path segments. Wildcard prefixes in hostname and wildcard suffixes in path reduce their respective scores by 2. Used for sorting routes so more specific routes are matched first.
Whether the hostname allows wildcard prefix matching. When true, the route matches any hostname that ends with the specified hostname. For example, if hostname is "example.com" and this is true, it matches "sub.example.com".
Whether the path allows wildcard suffix matching. When true, the route matches any path that starts with the specified path. For example, if path is "/api" and this is true, it matches "/api/users".
The hostname part of the route to match against. Can be an empty string when matching any hostname (wildcard '*'). In that instance, the matcher can leverage the fact that
.endsWith()
returnstrue
for empty strings.