vapor-docs/3.0/docs/services/getting-started.md

498 B

Configure

You configure the application in the configure.swift file. Here you can register your own services, or override the ones provided by default.

import Vapor

public func configure(...) throws {
    services.register {
        let foo = FooService(...)
        return foo
    }
}

Later, after your application has booted, you can then request your registered service.

let foo = try app.make(FooService.self)

Providers