import Hummingbird public extension RouterMethods { // MARK: Methods /// Adds the routes of ``RouterController`` values to the router using the /// ``RouteCollectionBuilder`` result builder. /// /// Mirrors `addMiddleware`, letting controllers be listed declaratively: /// /// ```swift /// router.addController { /// RootController() /// HealthController() /// } /// ``` /// /// Each controller's route collection is added at the router's root, exactly as a /// sequence of `addRoutes(_:)` calls would. /// - Parameter build: the controller stack result builder. /// - Returns: the router, so calls can be chained. @discardableResult func addController( @RouteCollectionBuilder _ build: () -> [RouteCollection] ) -> Self { for collection in build() { addRoutes(collection) } return self } }