Schafkopf-Server/Sources/App/configure.swift

21 lines
544 B
Swift
Raw Normal View History

2021-11-25 19:15:38 +01:00
import Vapor
2021-11-27 11:59:13 +01:00
var database: Database!
2021-11-25 19:15:38 +01:00
// configures your application
public func configure(_ app: Application) throws {
2021-12-09 14:47:18 +01:00
// Set target environment
2021-12-18 15:08:43 +01:00
app.environment = .production
app.logger.logLevel = .info // .notice
2021-12-09 14:47:18 +01:00
2021-11-27 11:59:13 +01:00
// serve files from /Public folder
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
2021-11-25 19:15:38 +01:00
2021-12-01 12:45:42 +01:00
let storageFolder = URL(fileURLWithPath: app.directory.resourcesDirectory)
database = try Database(storageFolder: storageFolder)
2021-11-25 19:15:38 +01:00
// register routes
try routes(app)
}