23 lines
667 B
Swift
23 lines
667 B
Swift
import Fluent
|
|
import FluentSQLiteDriver
|
|
import Leaf
|
|
import Vapor
|
|
|
|
// configures your application
|
|
public func configure(_ app: Application) async throws {
|
|
// uncomment to serve files from /Public folder
|
|
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
|
app.middleware.use(app.sessions.middleware)
|
|
app.databases.use(.sqlite(.file("db.sqlite")), as: .sqlite)
|
|
// app.databases.use(.sqlite(.memory), as: .sqlite)
|
|
app.migrations.add(CreateProCon())
|
|
app.migrations.add(CreateUser())
|
|
app.views.use(.leaf)
|
|
|
|
// register routes
|
|
try routes(app)
|
|
try app.register(collection: ApiController())
|
|
|
|
try await app.autoMigrate()
|
|
}
|