Domain Documentation

Structure APICollection

public struct APICollection  

Order for defining routing.

It was defined as a specification when ordering routing from the presentation layer to the domain layer.

Note

If possible, I wanted to define this class as an abstract order that does not depend on the framework, but I gave up it because it was difficult in Vapor.

Initializers

init(method:​paths:​closure:​middlewares:​)

public init(method: HTTPMethodInDomain,
                paths: [PathComponent],
                closure: @escaping (Request) throws -> Future<Response>,
                middlewares: [Middleware] = [])  

Default initializer.

Parameters

method HTTPMethod​InDomain

HTTPMethod to which API responds.

paths [Path​Component]

See PathComponent.

closure @escaping (Request) throws -> Future<Response>

API processing.

middlewares [Middleware]

Middleware that performs processing between Framework and Controller.

Properties

method

public let method: HTTPMethodInDomain

HTTPMethod to which API responds.

paths

public let paths: [PathComponent] 

See PathComponentsRepresentable.

closure

public let closure: (Request) throws -> Future<Response>

API processing.

middlewares

public let middlewares: [Middleware] 

Middleware that performs processing between Framework and Controller.