feat: Begins implementing dependencies as db controllers.

This commit is contained in:
2025-01-10 21:33:17 -05:00
parent 59b6d46606
commit 6f206bbd82
7 changed files with 235 additions and 106 deletions

View File

@@ -1,3 +1,4 @@
import Dependencies
import Fluent
import FluentSQLiteDriver
import Leaf
@@ -31,8 +32,12 @@ public func configure(_ app: Application) async throws {
app.views.use(.leaf)
// register routes
try routes(app)
try withDependencies {
$0.employees = .live(database: app.db(.sqlite))
} operation: {
// register routes
try routes(app)
}
if app.environment != .production {
try await app.autoMigrate()