URLPathMapper

public class URLPathMapper<Route> where Route : RouteType

Router URL Path Mapper.

Note

All static paths are resolved before dynamic paths.

Usage:

// Static path
$0.map("/users") { .allUsers }

// Dynamic path
$0.map("/users/{id}/profile") { try .profile(withID: $0.path("id")) }

Methods

  • Map a path to a route

    Note

    With the MatchedURL passed as a parameter in the callback

    Declaration

    Swift

    public func map(_ pathPattern: PathPattern, _ route: @escaping (MatchedURL) throws -> Route)
  • Map a path to a route

    Declaration

    Swift

    public func map(_ pathPattern: PathPattern, _ route: @escaping () throws -> Route)