Create
public final class Create<T> : CreateEndpoint where T : CorvusModel
A class that provides functionality to create objects of a generic type
T
conforming to CorvusModel
.
-
The return type of the
.handler()
.Declaration
Swift
public typealias QuerySubject = T
-
The HTTP operation type of the component.
Declaration
Swift
public let operationType: OperationType
-
An initializer for creation without arguments.
Declaration
Swift
public init()
-
A method that saves objects from a
Request
to the database.Throws
AnAbort
error if something goes wrong.Declaration
Swift
public func handler(_ req: Request) throws -> EventLoopFuture<QuerySubject>
Parameters
req
An incoming
Request
.Return Value
An
EventLoopFuture
containing the saved object.