Router

public class Router

The Router class provides the external interface for the routing of requests to the appropriate code for handling. This includes:

  • Routing requests to closures with the signature of RouterHandler
  • Routing requests to the handle function of classes that implement the RouterMiddleware protocol.
  • Routing the request to a template engine to generate the appropriate output.
  • Serving the landing page when someone makes an HTTP request with a path of slash (/).
  • The root directory for templates that will be automatically handed over to an appropriate templating engine for content generation.

    Declaration

    Swift

    public var viewsPath = "./Views/"
  • Initialize a Router instance

    Declaration

    Swift

    public init(mergeParameters: Bool = false)

    Parameters

    mergeParameters

    Specify if this router should have access to path parameters matched in its parent router. Defaults to false.

  • Sets the default templating engine to be used when the extension of a file in the viewsPath doesn’t match the extension of one of the registered templating engines.

    Declaration

    Swift

    public func setDefault(templateEngine: TemplateEngine?)

    Parameters

    templateEngine

    The new default templating engine

  • Register a templating engine. The templating engine will handle files in the viewsPath that match the extension it supports.

    Declaration

    Swift

    public func add(templateEngine: TemplateEngine, forFileExtensions fileExtensions: [String] = [],
                        useDefaultFileExtension: Bool = true)

    Parameters

    templateEngine

    The templating engine to register.

    forFileExtensions

    The extensions of the files to apply the template engine on.

    useDefaultFileExtension

    flag to specify if the default file extension of the template engine should be used

  • Setup a sub router to handle requests. This can make it easier to build a server that serves a large set of paths, by breaking it up in to sub router where each sub router is mapped to it’s own root path and handles all of the mappings of paths below that.

    Declaration

    Swift

    public func route(_ route: String, mergeParameters: Bool = false, allowPartialMatch: Bool = true) -> Router

    Parameters

    route

    The path to bind the sub router to.

    mergeParameters

    Specify if this router should have access to path parameters matched in its parent router. Defaults to false.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    Return Value

    The created sub router.

  • Setup a handler for specific name of request parameters. This can make it easier to handle values of provided parameter name.

    Declaration

    Swift

    public func parameter(_ name: String, handler: @escaping RouterParameterHandler...) -> Router

    Parameters

    name

    A single parameter name to be handled

    handler

    A comma delimited set of RouterParameterHandlers that will be invoked when request parses a parameter with specified name.

    Return Value

    Current router instance

  • Setup a handler for specific name of request parameters. This can make it easier to handle values of provided parameter name.

    Declaration

    Swift

    public func parameter(_ names: [String], handler: @escaping RouterParameterHandler...) -> Router

    Parameters

    names

    The array of parameter names that will be used to invoke handlers

    handler

    A comma delimited set of RouterParameterHandlers that will be invoked when request parses a parameter with specified name.

    Return Value

    Current router instance

  • Setup a handler for specific name of request parameters. This can make it easier to handle values of provided parameter name.

    Declaration

    Swift

    public func parameter(_ names: [String], handlers: [RouterParameterHandler]) -> Router

    Parameters

    names

    The array of parameter names that will be used to invoke handlers

    handlers

    The array of RouterParameterHandlers that will be invoked when request parses a parameter with specified name.

    Return Value

    Current router instance

  • Handle an HTTP request as a middleware. Used for sub routing.

    Declaration

    Swift

    public func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throws

    Parameters

    request

    The RouterRequest object that is used to work with the incoming request.

    response

    The RouterResponse object used to send responses to the HTTP request.

    next

    The closure to invoke to cause the router to inspect the path in the list of paths.

  • Handle the HTTP request

    Declaration

    Swift

    public func handle(request: ServerRequest, response: ServerResponse)

    Parameters

    request

    The ServerRequest object used to work with the incoming HTTP request at the Kitura-net API level.

    response

    The ServerResponse object used to send responses to the HTTP request at the Kitura-net API level.

  • Setup error handling that will cause a set of one or more closures of the type RouterHandler to be invoked when an error occurs.

    Declaration

    Swift

    public func error(_ handler: @escaping RouterHandler...) -> Router

    Parameters

    handler

    A comma delimited set of RouterHandler that will be invoked if an error ocurrs.

  • Setup error handling that will cause an array of one or more closures of the type RouterHandler to be invoked when an error occurs.

    Declaration

    Swift

    public func error(_ handler: [RouterHandler]) -> Router

    Parameters

    handler

    An array of RouterHandler that will be invoked if an error ocurrs.

  • Setup error handling that will cause a set of one or more RouterMiddleware to be invoked when an error occurs.

    Declaration

    Swift

    public func error(_ middleware: RouterMiddleware...) -> Router

    Parameters

    middleware

    A comma delimited set of RouterMiddleware that will be invoked if an error ocurrs.

  • Setup error handling that will cause an array of one or more RouterMiddleware to be invoked when an error occurs.

    Declaration

    Swift

    public func error(_ middleware: [RouterMiddleware]) -> Router

    Parameters

    middleware

    An array of RouterMiddleware that will be invoked if an error ocurrs.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when any request comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func all(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when any request comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when any request comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func all(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when any request comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when any request comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func all(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when any request comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when any request comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func all(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when any request comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP GET requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func get(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP GET requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP GET requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func get(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP GET requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP GET requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func get(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP GET requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP GET requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func get(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP GET requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP HEAD requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func head(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP HEAD requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP HEAD requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func head(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP HEAD requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP HEAD requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func head(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP HEAD requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP HEAD requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func head(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP HEAD requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP POST requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func post(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP POST requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP POST requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func post(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP POST requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP POST requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func post(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP POST requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP POST requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func post(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP POST requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP PUT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func put(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP PUT requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP PUT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func put(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP PUT requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP PUT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func put(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP PUT requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP PUT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func put(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP PUT requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP DELETE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func delete(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP DELETE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP DELETE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func delete(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP DELETE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP DELETE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func delete(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP DELETE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP DELETE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func delete(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP DELETE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP OPTIONS requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func options(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP OPTIONS requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP OPTIONS requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func options(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP OPTIONS requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP OPTIONS requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func options(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP OPTIONS requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP OPTIONS requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func options(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP OPTIONS requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP TRACE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func trace(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP TRACE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP TRACE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func trace(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP TRACE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP TRACE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func trace(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP TRACE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP TRACE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func trace(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP TRACE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP COPY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func copy(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP COPY requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP COPY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func copy(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP COPY requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP COPY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func copy(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP COPY requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP COPY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func copy(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP COPY requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP LOCK requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func lock(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP LOCK requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP LOCK requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func lock(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP LOCK requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP LOCK requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func lock(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP LOCK requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP LOCK requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func lock(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP LOCK requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP MKCOL requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkCol(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP MKCOL requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP MKCOL requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkCol(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP MKCOL requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP MKCOL requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkCol(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP MKCOL requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP MKCOL requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkCol(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP MKCOL requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP MOVE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func move(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP MOVE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP MOVE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func move(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP MOVE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP MOVE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func move(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP MOVE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP MOVE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func move(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP MOVE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP PURGE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func purge(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP PURGE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP PURGE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func purge(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP PURGE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP PURGE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func purge(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP PURGE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP PURGE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func purge(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP PURGE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP PROPFIND requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propFind(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP PROPFIND requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP PROPFIND requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propFind(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP PROPFIND requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP PROPFIND requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propFind(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP PROPFIND requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP PROPFIND requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propFind(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP PROPFIND requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP PROPPATCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propPatch(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP PROPPATCH requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP PROPPATCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propPatch(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP PROPPATCH requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP PROPPATCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propPatch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP PROPPATCH requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP PROPPATCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func propPatch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP PROPPATCH requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP UNLOCK requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unlock(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP UNLOCK requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP UNLOCK requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unlock(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP UNLOCK requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP UNLOCK requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unlock(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP UNLOCK requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP UNLOCK requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unlock(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP UNLOCK requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP REPORT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func report(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP REPORT requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP REPORT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func report(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP REPORT requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP REPORT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func report(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP REPORT requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP REPORT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func report(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP REPORT requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP MKACTIVITY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkActivity(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP MKACTIVITY requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP MKACTIVITY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkActivity(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP MKACTIVITY requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP MKACTIVITY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkActivity(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP MKACTIVITY requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP MKACTIVITY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mkActivity(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP MKACTIVITY requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP CHECKOUT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func checkout(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP CHECKOUT requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP CHECKOUT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func checkout(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP CHECKOUT requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP CHECKOUT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func checkout(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP CHECKOUT requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP CHECKOUT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func checkout(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP CHECKOUT requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP MERGE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func merge(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP MERGE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP MERGE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func merge(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP MERGE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP MERGE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func merge(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP MERGE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP MERGE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func merge(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP MERGE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP MSEARCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mSearch(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP MSEARCH requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP MSEARCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mSearch(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP MSEARCH requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP MSEARCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mSearch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP MSEARCH requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP MSEARCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func mSearch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP MSEARCH requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP NOTIFY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func notify(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP NOTIFY requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP NOTIFY requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func notify(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP NOTIFY requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP NOTIFY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func notify(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP NOTIFY requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP NOTIFY requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func notify(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP NOTIFY requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP SUBSCRIBE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func subscribe(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP SUBSCRIBE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP SUBSCRIBE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func subscribe(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP SUBSCRIBE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP SUBSCRIBE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func subscribe(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP SUBSCRIBE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP SUBSCRIBE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func subscribe(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP SUBSCRIBE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP UNSUBSCRIBE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unsubscribe(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP UNSUBSCRIBE requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP UNSUBSCRIBE requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unsubscribe(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP UNSUBSCRIBE requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP UNSUBSCRIBE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unsubscribe(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP UNSUBSCRIBE requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP UNSUBSCRIBE requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func unsubscribe(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP UNSUBSCRIBE requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP PATCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func patch(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP PATCH requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP PATCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func patch(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP PATCH requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP PATCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func patch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP PATCH requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP PATCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func patch(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP PATCH requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP SEARCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func search(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP SEARCH requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP SEARCH requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func search(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP SEARCH requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP SEARCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func search(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP SEARCH requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP SEARCH requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func search(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP SEARCH requests comes to the server.

  • Setup a set of one or more closures of the type RouterHandler that will be invoked when HTTP CONNECT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func connect(_ path: String?=nil, handler: @escaping RouterHandler...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    A comma delimited set of RouterHandlers that will be invoked when HTTP CONNECT requests comes to the server.

  • Setup an array of one or more closures of the type RouterHandler that will be invoked when HTTP CONNECT requests comes to the server. If a path pattern is specified, the handlers will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func connect(_ path: String?=nil, handler: [RouterHandler]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the handlers to be invoked.

    handler

    The array of RouterHandlers that will be invoked when HTTP CONNECT requests comes to the server.

  • Setup a set of one or more RouterMiddleware that will be invoked when HTTP CONNECT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func connect(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: RouterMiddleware...) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    A comma delimited set of RouterMiddleware that will be invoked when HTTP CONNECT requests comes to the server.

  • Setup an array of one or more RouterMiddleware that will be invoked when HTTP CONNECT requests comes to the server. If a path pattern is specified, the RouterMiddleware will only be invoked if the pattern is matched.

    Declaration

    Swift

    public func connect(_ path: String?=nil, allowPartialMatch: Bool = true, middleware: [RouterMiddleware]) -> Router

    Parameters

    path

    An optional String specifying the pattern that needs to be matched, in order for the RouterMiddleware to be invoked.

    allowPartialMatch

    A Bool that indicates whether or not a partial match of the path by the pattern is sufficient.

    handler

    The array of RouterMiddleware that will be invoked when HTTP CONNECT requests comes to the server.