You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
855 B
22 lines
855 B
import NIOSSL |
|
import Fluent |
|
import FluentMySQLDriver |
|
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.databases.use(DatabaseConfigurationFactory.mysql( |
|
hostname: Environment.get("DATABASE_HOST") ?? "localhost", |
|
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? MySQLConfiguration.ianaPortNumber, |
|
username: Environment.get("DATABASE_USERNAME") ?? "vapor_username", |
|
password: Environment.get("DATABASE_PASSWORD") ?? "vapor_password", |
|
database: Environment.get("DATABASE_NAME") ?? "vapor_database" |
|
), as: .mysql) |
|
|
|
app.migrations.add(CreateTodo()) |
|
// register routes |
|
try routes(app) |
|
}
|
|
|