Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

run()

Runs the application as a Service (no signal handling).
func run() async throws

Discussion

Use this when embedding the application in your own ServiceGroup:

let serviceGroup = ServiceGroup(
    configuration: .init(
        services: [.init(service: app)],
        gracefulShutdownSignals: [.sigterm, .sigint]
    )
)
try await serviceGroup.run()

Blocks until all services (including the HTTP server) have stopped. Graceful shutdown is triggered by the parent task or ServiceGroup.