This PR contains the work done to do a little bit of housekeeping pass across all packages and the Website service. To provide further details about the work: * Refreshed the READMEs and source documentation to match the current code; * Tagged every test case consistently across the Infrastructure, Localization, Persistence, and Website test targets; * Removed Website middleware tests now covered by Infrastructure's own suite; * Conformed the `PrepareDB` method to Sendable; * Relaxes the production Compose DATABASE_TLS default from require to prefer; * Added Persistence test verifying the prefer posture falls back to plaintext connections. Reviewed-on: rock-n-code/loud-amsterdam#27 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
33 lines
1013 B
Swift
33 lines
1013 B
Swift
import Hummingbird
|
|
|
|
/// A type exposing its endpoints as a route collection ready to be added to a router.
|
|
///
|
|
/// Conforming controllers group related endpoints behind a single ``routes`` property, so the application composes them declaratively with
|
|
/// ``Hummingbird/RouterMethods/addController(_:)``:
|
|
///
|
|
/// ```swift
|
|
/// struct HealthController<Context: RequestContext>: RouterController {
|
|
/// var routes: RouteCollection<Context> {
|
|
/// RouteCollection(context: Context.self)
|
|
/// .get("health") { _, _ in HTTPResponse.Status.ok }
|
|
/// }
|
|
/// }
|
|
///
|
|
/// router.addController {
|
|
/// HealthController<AppRequestContext>()
|
|
/// }
|
|
/// ```
|
|
public protocol RouterController<Context>: Sendable {
|
|
|
|
// MARK: Associated types
|
|
|
|
/// The request context the controller's routes operate on.
|
|
associatedtype Context: RequestContext
|
|
|
|
// MARK: Properties
|
|
|
|
/// The collection of routes the controller exposes.
|
|
var routes: RouteCollection<Context> { get }
|
|
|
|
}
|