Renamed the Web package as Infrastructure (#24)
Reviewed-on: rock-n-code/loud-amsterdam#24 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import Hummingbird
|
||||
import Infrastructure
|
||||
|
||||
/// A controller serving its path back as plain text, used to observe route registration.
|
||||
struct StubController {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// The path the controller serves, also returned as the response body.
|
||||
let path: String
|
||||
|
||||
}
|
||||
|
||||
// MARK: - RouterController
|
||||
|
||||
extension StubController: RouterController {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var routes: RouteCollection<BasicRequestContext> {
|
||||
let routes = RouteCollection(context: BasicRequestContext.self)
|
||||
|
||||
routes.get(.init(path)) { _, _ in
|
||||
self.path
|
||||
}
|
||||
|
||||
return routes
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user