feat: Begins breaking out database interfaces and api controllers into seperate items.

This commit is contained in:
2025-01-10 13:31:56 -05:00
parent 3f30327fd8
commit 88ee71cb68
14 changed files with 624 additions and 36 deletions

View File

@@ -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()
)
}
}