November 2018
Intermediate to advanced
404 pages
10h 16m
English
App is the top class for the App module, and it handles the main life cycle functions for the application:
// File: /Application/Application.swiftimport Foundationimport Kituraimport LoggerAPIimport Configurationimport CloudEnvironmentimport KituraContractsimport Healthpublic let projectPath = ConfigurationManager.BasePath.project.pathpublic let health = Health()public class App { let router = Router() let cloudEnv = CloudEnv() public init() throws { // [1] // Run the metrics initializer initializeMetrics(router: router) } func postInit() throws { // Endpoints initializeHealthRoutes(app: self) } public func run() throws { try postInit() // [2] Kitura.addHTTPServer(onPort: cloudEnv.port, with: router) // [3] ...Read now
Unlock full access