feat: Begins breaking out database interfaces and api controllers into seperate items.
This commit is contained in:
@@ -12,4 +12,19 @@ extension RoutesBuilder {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
func apiUnprotected(route: PathComponent) -> any RoutesBuilder {
|
||||
grouped("api", "v1", route)
|
||||
}
|
||||
|
||||
// Allows basic or token authentication for api routes and prefixes the
|
||||
// given route with "/api/v1".
|
||||
func apiProtected(route: PathComponent) -> any RoutesBuilder {
|
||||
let prefixed = grouped("api", "v1", route)
|
||||
return prefixed.grouped(
|
||||
User.authenticator(),
|
||||
UserToken.authenticator(),
|
||||
User.guardMiddleware()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user