RoutingMiddleware
public struct RoutingMiddleware : Middleware
Resolves a Route
for a Request
and calls its handler method. Returns a .notFound
Response
if it can’t match any Route
s. By default, the
RoutingMiddleware
is already registered for Chaqmoq
applications. If you override the middleware
property, make sure you add it explicitly.
Keep in mind that it is almost always better to register the RoutingMiddleware
at the end of Middleware
stack.
-
The current application’s
Router
.Declaration
Swift
@Injected public private(set) var router: Router { get set }
-
Initializes a new instance of
RoutingMiddleware
.Declaration
Swift
public init()
-
handle(request:
AsynchronousnextHandler: ) See
Middleware
.Declaration
Swift
public func handle( request: Request, nextHandler: @escaping (Request) async throws -> Response ) async throws -> Response