Structures

The following structures are available globally.

  • This struct represents request and response application filters. You can create AppFilters and use it in Application initialization

    Declaration

    Swift

    public struct AppFilters
  • This struct represnts an Application with its configuration, routes and filters. You could use this application or create another Application object that complies with AppProtocol.

    See

    see also: AppProtocol
    See more

    Declaration

    Swift

    public struct Application : AppProtocol
  • This struct represents the configuration of an application

    Example usage:

    // path represents a json file location that have the same key names as the struct props
    let file = File(path)
    if file.exists == false {
        print("Configuration file doesn't exist!")
    }
    do {
        try file.open(.read, permissions: .readUser)
        defer { file.close() }
        let json = try file.readString()
        let conf = try Configuration(json)
        app.config = conf // assign it to your application's config to be used when you launch the server
    } catch {
        print(error)
    }
    
    See more

    Declaration

    Swift

    public struct Configuration : Codable
  • This struct represents the server configuration

    Declaration

    Swift

    public struct ServerConfiguration : Codable
  • configuration for logging

    Declaration

    Swift

    public struct LoggingConfiguration : Codable
  • database configuration that should be initialized when Configuration is initialized. ScantORM uses this configuration to initialize the DatabaseAdapter. You can use it without ScantORM if you need to!

    See more

    Declaration

    Swift

    public struct DBConfiguration : Codable
  • SSL configuration for https server

    Declaration

    Swift

    public struct SSLConfiguration : Codable