class HTTP::RouterBuilder

Collects routes for Router.build. A pattern is a path whose segments may be {name} (one segment) or, last, {name...} (the rest of the path, possibly empty, slashes included); a trailing slash is significant.

<std:http>:1602

Methods

def handle(method: String, pattern: String, handler: HTTP::Handler) -> Void

Routes method requests matching pattern to handler. Raises ArgumentError for a pattern that does not start with /, or one conflicting with a route already added.

<std:http>:1611

def handle(method: String, pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

The same, with a handler from the block.

<std:http>:1624

def get(pattern: String, handler: HTTP::Handler) -> Void

Routes GET requests matching pattern: #handle.

<std:http>:1629

def get(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes GET requests matching pattern: #handle.

<std:http>:1631

def head(pattern: String, handler: HTTP::Handler) -> Void

Routes HEAD requests matching pattern: #handle.

<std:http>:1633

def head(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes HEAD requests matching pattern: #handle.

<std:http>:1635

def post(pattern: String, handler: HTTP::Handler) -> Void

Routes POST requests matching pattern: #handle.

<std:http>:1637

def post(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes POST requests matching pattern: #handle.

<std:http>:1639

def put(pattern: String, handler: HTTP::Handler) -> Void

Routes PUT requests matching pattern: #handle.

<std:http>:1641

def put(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes PUT requests matching pattern: #handle.

<std:http>:1643

def patch(pattern: String, handler: HTTP::Handler) -> Void

Routes PATCH requests matching pattern: #handle.

<std:http>:1645

def patch(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes PATCH requests matching pattern: #handle.

<std:http>:1647

def delete(pattern: String, handler: HTTP::Handler) -> Void

Routes DELETE requests matching pattern: #handle.

<std:http>:1649

def delete(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes DELETE requests matching pattern: #handle.

<std:http>:1651

def options(pattern: String, handler: HTTP::Handler) -> Void

Routes OPTIONS requests matching pattern: #handle.

<std:http>:1653

def options(pattern: String, &blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

Routes OPTIONS requests matching pattern: #handle.

<std:http>:1655

def mount(prefix: String, router: HTTP::Router) -> Void

Another router's routes under prefix.

<std:http>:1658

def not_found(handler: HTTP::Handler) -> Void

The handler of a path no route has (by default, Response.not_found).

<std:http>:1668

def not_found(&blk: shareable (HTTP::Request) -> HTTP::Response) -> Void

The handler of a path no route has (by default, Response.not_found).

<std:http>:1674

def to_router -> HTTP::Router

The router of the routes added so far.

<std:http>:1680