Composes this endpoint with the given that
endpoint.
Composes this endpoint with the given that
endpoint. The resulting endpoint will succeed only
if both this and that
endpoints succeed.
Composes this endpoint with another in such a way that coproducts are flattened.
Composes this endpoint with the given RequestReader.
Maps this endpoint to Endpoint[A => B]
.
Maps this endpoint to either A => Output[B]
or A => Output[Future[B]]
.
Maps this endpoint to the given function A => Future[B]
.
Recovers from any exception occurred in this endpoint by creating a new endpoint that will handle any matching throwable from the underlying future.
Maps this endpoint to the given function A => B
.
Recovers from any exception occurred in this endpoint by creating a new endpoint that will handle any matching throwable from the underlying future.
Converts this endpoint to a Finagle service Request => Future[Response]
.
Sequentially composes this endpoint with the given that
endpoint.
Sequentially composes this endpoint with the given that
endpoint. The resulting router will
succeed if either this or that
endpoints are succeed.
An
Endpoint
represents the HTTP endpoint.I is well known and widely adopted in Finagle that "Your Server as a Function" (i.e.,
Request => Future[Response]
. In a REST API setting this function may be viewed asRequest =1=> (A =2=> Future[B]) =3=> Future[Response]
, where transformation1
is request decoding (deserialization), transformation2
- is business logic and transformation3
is- response encoding (serialization). The only interesting part here is transformation2
(i.e.,A => Future[B]
), which represents a bossiness logic of an application.An
Endpoint
transformation (map
,embedFlatMap
, etc.) encodes the business logic, while the rest of Finch ecosystem takes care about both serialization and deserialization.A typical way to transform (or map) the
Endpoint
is to use Mapper andEndpoint.apply
method, which, depending on the argument type, delegates the map operation to the underlying function.Endpoint
s are also composable in terms of or-else combinator (or a space invader:+:
) that takes twoEndpoint
s and gives a coproductEndpoint
.val foobar: Endpoint[Foo :+: Bar :+: CNil] = foo :+: bar
An
Endpoint
might be converted into a Finagle Service withEndpoint.toService
method so it can be served with Finagle HTTP.