HttpRoutes

object HttpRoutes

Functions for creating HttpRoutes kleislis.

class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[F[_]](run: Request[F] => OptionT[F, Response[F]])(implicit evidence$1: Monad[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 Params
F

the effect of the HttpRoutes

Value Params
run

the function to lift

Returns

an HttpRoutes that wraps run

def empty[F[_]](implicit evidence$5: Applicative[F]): HttpRoutes[F]

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

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

Type Params
F

the base effect of the HttpRoutes

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 Params
F

the effect of the HttpRoutes

Value Params
fr

the effectful Response to lift

Returns

an HttpRoutes that always returns fr

def local[F[_]](f: Request[F] => Request[F])(fa: HttpRoutes[F])(implicit evidence$2: Monad[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 Params
F

the base effect of the HttpRoutes

Value Params
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

def of[F[_]](pf: PartialFunction[Request[F], F[Response[F]]])(implicit evidence$3: Monad[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 Params
F

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

Value Params
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

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 Params
F

the base effect of the HttpRoutes

Value Params
r

the Response to lift

Returns

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

def strict[F[_]](pf: PartialFunction[Request[F], F[Response[F]]])(implicit evidence$4: Applicative[F]): HttpRoutes[F]

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 Params
F

the base effect of the HttpRoutes

Value Params
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