feat: Initial commit
This commit is contained in:
20
Sources/ApiController/ApiController.swift
Normal file
20
Sources/ApiController/ApiController.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
import Dependencies
|
||||
import DependenciesMacros
|
||||
import Logging
|
||||
import Routes
|
||||
|
||||
public extension DependencyValues {
|
||||
var apiController: ApiController {
|
||||
get { self[ApiController.self] }
|
||||
set { self[ApiController.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
@DependencyClient
|
||||
public struct ApiController: Sendable {
|
||||
public var json: @Sendable (SiteRoute.Api, Logger) async throws -> (any Encodable)?
|
||||
}
|
||||
|
||||
extension ApiController: TestDependencyKey {
|
||||
public static let testValue: ApiController = Self()
|
||||
}
|
||||
Reference in New Issue
Block a user