-
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 } -
pathComponentsDefault implementationAn array of
PathComponentdescribing the path that theTypedEndpointextends.Default Implementation
The empty
pathComponentsof 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
reqThe incoming
Request.Return Value
An
EventLoopFuturecontaining 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
reqThe incoming
Request.Return Value
A
QueryBuilderfor 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
asA type conforming to
CorvusResponse.Return Value
An instance of a
ResponseModifierwith the suppliedCorvusResponse. -
register(to:Extension method) Registers the component to the
Vaporrouter depending on itsoperationType.Declaration
Swift
func register(to routes: RoutesBuilder)Parameters
routesThe
RoutesBuilderto extend.
RestEndpoint Protocol Reference