19 lines
506 B
Swift
19 lines
506 B
Swift
import Vapor
|
|
import Leaf
|
|
import LeafErrorMiddleware
|
|
|
|
// configures your application
|
|
public func configure(_ app: Application) throws {
|
|
// Serve files from /Public
|
|
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
|
app.middleware.use(LeafErrorMiddleware())
|
|
|
|
// Configure Leaf
|
|
LeafOption.caching = app.environment.isRelease ? .default : .bypass
|
|
LeafRenderer.Option.timeout = 200.0
|
|
app.views.use(.leaf)
|
|
|
|
// Register routes
|
|
try routes(app)
|
|
}
|