Options
All
  • Public
  • Public/Protected
  • All
Menu

router

Index

Type aliases

HttpRouterHandler

HttpRouterHandler<T, U>: function

The handler called when a match is found

Type parameters

Type declaration

RouteHandler

RouteHandler<T>: function

Type parameters

  • T: unknown[]

Type declaration

RouteMatchParams

RouteMatchParams: object

Type declaration

  • [key: string]: string

Functions

Const compileRoute

  • compileRoute(route: string): RegExp
  • Compiles a route to a RegExp pattern

    compileRoute('/user/:id')
    // /^\/user\/(?<id>[,a-zA-Z0-9%_-]*)(\?[a-zA-Z0-9%_=&-]*)?$/
    
    compileRoute('/@(\\w{1,16})/get/:id')
    // /^\/@(\w{1,16})\/get\/(?<id>[,a-zA-Z0-9%_-]*)(\?[a-zA-Z0-9%_=&-]*)?$/

    Parameters

    • route: string

    Returns RegExp

Generated using TypeDoc