21 lines
544 B
Swift
21 lines
544 B
Swift
import Vapor
|
|
|
|
var database: Database!
|
|
|
|
// configures your application
|
|
public func configure(_ app: Application) throws {
|
|
|
|
// Set target environment
|
|
app.environment = .production
|
|
app.logger.logLevel = .info // .notice
|
|
|
|
// serve files from /Public folder
|
|
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
|
|
|
let storageFolder = URL(fileURLWithPath: app.directory.resourcesDirectory)
|
|
database = try Database(storageFolder: storageFolder)
|
|
|
|
// register routes
|
|
try routes(app)
|
|
}
|