Iskra API Reference
    Preparing search index...

    Class RouteGroup

    Routes under a prefix with the middleware they share. A subgroup inherits its parent's middleware; use() adds middleware to the routes added after it. See Router.

    Hierarchy (View Summary)

    Index
    • Parameters

      • registry: Registry
      • prefix: string

        The group's path prefix, /api/v1.

      • middleware: readonly RouteHandler[]

      Returns RouteGroup

    prefix: string

    The group's path prefix, /api/v1.

    registry: Registry
    • A route for every method (a named method's route on the same path comes first).

      Parameters

      Returns this

    • Parameters

      Returns this

    • Parameters

      Returns this

    • A subgroup under prefix: this group's middleware, then middleware.

      Parameters

      Returns RouteGroup

    • A route for method (or several): the group's middleware, then handlers.

      Parameters

      • method: string | readonly string[]
      • path: string
      • ...handlers: RouteHandler[]

      Returns this

    • Parameters

      Returns this

    • Parameters

      Returns this

    post

    • post(path: string, ...handlers: RouteHandler[]): this

      Parameters

      Returns this

    • Parameters

      Returns this

    • What happens to a request under this group's prefix that no route takes (an unknown path, a method with no route, a made-up method): it runs use (by default the group's middleware), then answers 404, or 405 with then: 'auto', by the response contract. Called again for the same prefix, the last call wins.

      Parameters

      Returns this

    • Adds middleware to the routes (and subgroups) added after this call.

      Parameters

      Returns this