From f07b4d7618bf48b450ed11c9f85b74ba8b9bae6c Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 24 May 2022 11:36:14 -0400 Subject: [PATCH] Make middleware public (#10) --- Sources/VaporRouting/VaporRouting.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/VaporRouting/VaporRouting.swift b/Sources/VaporRouting/VaporRouting.swift index 49e079aee6..4663d5a75a 100644 --- a/Sources/VaporRouting/VaporRouting.swift +++ b/Sources/VaporRouting/VaporRouting.swift @@ -12,11 +12,17 @@ extension Application { _ router: R, use closure: @escaping (Request, R.Output) async throws -> AsyncResponseEncodable ) where R.Input == URLRequestData { - self.middleware.use(RoutingMiddleware(router: router, respond: closure)) + self.middleware.use(AsyncRoutingMiddleware(router: router, respond: closure)) } } -private struct RoutingMiddleware: AsyncMiddleware +/// Serves requests using a router and response handler. +/// +/// You will not typically need to interact with this type directly. Instead you should use the +/// `mount` method on your Vapor application. +/// +/// See ``VaporRouting`` for more information on usage. +public struct AsyncRoutingMiddleware: AsyncMiddleware where Router.Input == URLRequestData { let router: Router let respond: (Request, Router.Output) async throws -> AsyncResponseEncodable