Class
Application
Core type representing a Vapor application.
final class Application
Topics
Structures
struct LifecycleErrorAsking an application to do something its lifecycle does not allow.struct ServiceConfiguration
Initializers
Instance Properties
let cache: any CacheTheCacheconfigured in the applicationlet client: any ClientTheClientconfigured in the applicationlet configReader: ConfigReaderConfiguration reader used to read configuration values.var didShutdown: Boollet directoryConfiguration: DirectoryConfigurationThe directory information the app is running inlet environment: EnvironmentThe environment the application is running invar fileio: FileIOvar middleware: Middlewaresvar routes: RoutesThe routes registered on this application.let server: any ServerThe application’s HTTP server.var serverConfiguration: ServerConfigurationlet sessionDriver: any SessionDriverTheSessionDriverconfigured in the applicationvar sessionsMiddleware: SessionsMiddlewarevar state: StateWhere the application is in its lifecycle.let viewRenderer: any ViewRendererTheViewRendererconfigured in the application
Instance Methods
func addLifecycleHandler(any LifecycleHandler)Register aLifecycleHandlerwith the application. Vapor will call the different lifecycle events when they are reachedfunc addService(any Service)Register an additionalServiceto run alongside the HTTP server.func boot() async throwsCalled when the applications starts up, will trigger the lifecycle handlers. The asynchronous version ofboot()func routesASCIITable() -> StringReturns all routes registered to theApplication’sRouterin an ASCII-formatted tableString.func run() async throwsRuns the application as aService(no signal handling).func shutdown() async throwsfunc start() async throwsStarts the application as a standalone process with signal handling.
Enumerations
enum AddressConfigurationErrorErrors that may be thrown when serving a serverenum ServiceOptionTypeenum StateWhere the application is in its lifecycle.
Default Implementations
Relationships
Conforms To
RoutesBuilderServiceLifecycle.ServiceSwift.CopyableSwift.EscapableSwift.SendableSwift.SendableMetatype