HttpRoutes

object HttpRoutes

Functions for creating HttpRoutes kleislis.

Source:
HttpRoutes.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[F[_] : Monad](run: Request[F] => OptionT[F, Response[F]]): HttpRoutes[F]

Lifts a function into an HttpRoutes. The application of run is suspended in F to permit more efficient combination of routes via SemigroupK.

Lifts a function into an HttpRoutes. The application of run is suspended in F to permit more efficient combination of routes via SemigroupK.

Type parameters:
F

the effect of the HttpRoutes

Value parameters:
run

the function to lift

Returns:

an HttpRoutes that wraps run

Source:
HttpRoutes.scala

An empty set of routes. Always responds with OptionT.none.

An empty set of routes. Always responds with OptionT.none.

Type parameters:
F

the base effect of the HttpRoutes

Source:
HttpRoutes.scala
def liftF[F[_]](fr: OptionT[F, Response[F]]): HttpRoutes[F]

Lifts an effectful Response into an HttpRoutes.

Lifts an effectful Response into an HttpRoutes.

Type parameters:
F

the effect of the HttpRoutes

Value parameters:
fr

the effectful Response to lift

Returns:

an HttpRoutes that always returns fr

Source:
HttpRoutes.scala
def local[F[_] : Monad](f: Request[F] => Request[F])(fa: HttpRoutes[F]): HttpRoutes[F]

Transforms an HttpRoutes on its input. The application of the transformed function is suspended in F to permit more efficient combination of routes via SemigroupK.

Transforms an HttpRoutes on its input. The application of the transformed function is suspended in F to permit more efficient combination of routes via SemigroupK.

Type parameters:
F

the base effect of the HttpRoutes

Value parameters:
f

a function to apply to the Request

fa

the HttpRoutes to transform

Returns:

An HttpRoutes whose input is transformed by f before being applied to fa

Source:
HttpRoutes.scala
def of[F[_] : Monad](pf: PartialFunction[Request[F], F[Response[F]]]): HttpRoutes[F]

Lifts a partial function into an HttpRoutes. The application of the partial function is suspended in F to permit more efficient combination of routes via SemigroupK.

Lifts a partial function into an HttpRoutes. The application of the partial function is suspended in F to permit more efficient combination of routes via SemigroupK.

Type parameters:
F

the base effect of the HttpRoutes - Defer suspends evaluation of routes, so only 1 section of routes is checked at a time.

Value parameters:
pf

the partial function to lift

Returns:

An HttpRoutes that returns some Response in an OptionT[F, *] wherever pf is defined, an OptionT.none wherever it is not

Source:
HttpRoutes.scala
def pure[F[_]](r: Response[F])(implicit FO: Applicative[[_] =>> OptionT[F, _$4]]): HttpRoutes[F]

Lifts a Response into an HttpRoutes.

Lifts a Response into an HttpRoutes.

Type parameters:
F

the base effect of the HttpRoutes

Value parameters:
r

the Response to lift

Returns:

an HttpRoutes that always returns r in effect OptionT[F, *]

Source:
HttpRoutes.scala

Lifts a partial function into an HttpRoutes. The application of the partial function is not suspended in F, unlike of. This allows for less constraints when not combining many routes.

Lifts a partial function into an HttpRoutes. The application of the partial function is not suspended in F, unlike of. This allows for less constraints when not combining many routes.

Type parameters:
F

the base effect of the HttpRoutes

Value parameters:
pf

the partial function to lift

Returns:

An HttpRoutes that returns some Response in an OptionT[F, *] wherever pf is defined, an OptionT.none wherever it is not

Source:
HttpRoutes.scala