Class
Application
Core type representing a Vapor application.
final class Application
Topics
Classes
Structures
struct Cachesstruct Clientsstruct Corestruct HTTPstruct Lifecyclestruct Passwordstruct Passwordsstruct Responderstruct Runningstruct Serversstruct Servicestruct Servicesstruct Sessionsstruct Views
Initializers
Instance Properties
var allocator: ByteBufferAllocatorvar asyncCommands: AsyncCommandsvar cache: any CacheCurrent application cache. SeeRequest.cachefor caching in request handlers.var caches: Application.CachesControls application’s configured caches.var client: any Clientvar clients: Application.Clientsvar commands: Commandsvar console: any Consolevar didShutdown: Boolvar directory: DirectoryConfigurationvar environment: Environmentlet eventLoopGroup: any EventLoopGrouplet eventLoopGroupProvider: Application.EventLoopGroupProvidervar fileio: NonBlockingFileIOvar http: Application.HTTPvar lifecycle: Application.Lifecyclevar locks: Application.Locksvar logger: Loggervar middleware: Middlewaresvar password: Application.Passwordvar passwords: Application.Passwordsvar responder: Application.Respondervar routes: Routesvar running: Application.Running?var server: any Servervar servers: Application.Serversvar services: Application.Servicesvar sessions: Application.Sessionsvar storage: Storagevar sync: NIOLockvar threadPool: NIOThreadPoolThe application thread pool. Vapor usesNIOSingletons.posixBlockingThreadPoolby default for this, which defaults to a thread pool of size equal to the number of available cores.var traceAutoPropagation: BoolIf enabled, tracing propagation is automatically handled by restoring & settingrequest.serviceContextautomatically across Vapor-internal EventLoopFuture boundaries. If disabled, traces will not automatically nest, and the user should restore & setrequest.serviceContextmanually where needed. There are performance implications to enabling this feature.var view: any ViewRenderervar views: Application.Views
Instance Methods
func asyncBoot() async throwsCalled when the applications starts up, will trigger the lifecycle handlers. The asynchronous version ofboot()func asyncShutdown() async throwsfunc boot() throwsfunc execute() async throwsStarts theApplicationasynchronous using thestartup()method, then waits for any running tasks to complete. If your application is started without arguments, the default argument is used.func run() throwsStarts theApplicationusing thestart()method, then waits for any running tasks to complete. If your application is started without arguments, the default argument is used.func shutdown()func start() throwsWhen called, this will execute the startup command provided through an argument. If no startup command is provided, the default is used. Under normal circumstances, this will start running Vapor’s webserver.func startup() async throwsWhen called, this will asynchronously execute the startup command provided through an argument. If no startup command is provided, the default is used. Under normal circumstances, this will start running Vapor’s webserver.
Type Methods
static func make(Environment, Application.EventLoopGroupProvider) async throws -> Applicationstatic func make(Environment, Application.EventLoopGroupProvider, logger: Logger) async throws -> Application
Enumerations
Default Implementations
Relationships
Conforms To
RoutesBuilderSwift.CopyableSwift.EscapableSwift.SendableSwift.SendableMetatype