-
The type returned after from the
.handler()
.Declaration
Swift
associatedtype Element : ResponseEncodable
-
The subject of an operation’s queries in its
.query()
method.Declaration
Swift
associatedtype QuerySubject : CorvusModel
-
The HTTP method of the functionality of the component.
Declaration
Swift
var operationType: OperationType { get }
-
pathComponents
Default implementationAn array of
PathComponent
describing the path that theTypedEndpoint
extends.Default Implementation
The empty
pathComponents
of theRestEndpoint
.Declaration
Swift
var pathComponents: [PathComponent] { get }
-
A method that runs logic on the results of the
.query()
and returns those results asynchronously in anEventLoopFuture
.Throws
An error if something goes wrong.Declaration
Swift
func handler(_ req: Request) throws -> EventLoopFuture<Element>
Parameters
req
The incoming
Request
.Return Value
An
EventLoopFuture
containing the processed object. -
query(_:
Default implementation) A method to run database queries on a component’s
QuerySubject
.Throws
An error if something goes wrong.Default Implementation
A default implementation of
.query()
for components that do not require customized database queries.Throws
An error if something goes wrong.Declaration
Swift
func query(_ req: Request) throws -> QueryBuilder<QuerySubject>
Parameters
req
The incoming
Request
.Return Value
A
QueryBuilder
for further querying after this.query
. -
respond(with:
Extension method) A modifier used to transform the values returned by a component using a
CorvusResponse
.Declaration
Swift
public func respond<R: CorvusResponse>( with: R.Type ) -> ResponseModifier<Self, R>
Parameters
as
A type conforming to
CorvusResponse
.Return Value
An instance of a
ResponseModifier
with the suppliedCorvusResponse
. -
register(to:
Extension method) Registers the component to the
Vapor
router depending on itsoperationType
.Declaration
Swift
func register(to routes: RoutesBuilder)
Parameters
routes
The
RoutesBuilder
to extend.