ContextRoutes

org.http4s.ContextRoutes
object ContextRoutes

Attributes

Source
ContextRoutes.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[T, F[_]](run: ContextRequest[F, T] => OptionT[F, Response[F]])(implicit F: Monad[F]): ContextRoutes[T, F]

Lifts a function into an ContextRoutes.

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

Type parameters

F

the effect of the ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

run

the function to lift

Attributes

Returns

an ContextRoutes that wraps run

Source
ContextRoutes.scala
def empty[T, F[_] : Applicative]: ContextRoutes[T, F]

The empty service (all requests fallthrough).

The empty service (all requests fallthrough).

Type parameters

T

- ignored.

Attributes

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

Lifts an effectful Response into an ContextRoutes.

Lifts an effectful Response into an ContextRoutes.

Type parameters

F

the effect of the ContextRoutes

Value parameters

fr

the effectful Response to lift

Attributes

Returns

an ContextRoutes that always returns fr

Source
ContextRoutes.scala
def local[T, F[_] : Monad](f: ContextRequest[F, T] => ContextRequest[F, T])(fa: ContextRoutes[T, F]): ContextRoutes[T, F]

Transforms an ContextRequest on its input.

Transforms an ContextRequest 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 ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

f

a function to apply to the ContextRequest

fa

the ContextRoutes to transform

Attributes

Returns

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

Source
ContextRoutes.scala
def of[T, F[_]](pf: PartialFunction[ContextRequest[F, T], F[Response[F]]])(implicit F: Monad[F]): ContextRoutes[T, F]

Lifts a partial function into an ContextRoutes.

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

Type parameters

F

the base effect of the ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

pf

the partial function to lift

Attributes

Returns

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

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

Lifts a Response into an ContextRoutes.

Lifts a Response into an ContextRoutes.

Type parameters

F

the base effect of the ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

r

the Response to lift

Attributes

Returns

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

Source
ContextRoutes.scala
def strict[T, F[_] : Applicative](pf: PartialFunction[ContextRequest[F, T], F[Response[F]]]): ContextRoutes[T, F]

Lifts a partial function into an ContextRoutes.

Lifts a partial function into an ContextRoutes. 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 ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

pf

the partial function to lift

Attributes

Returns

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

Source
ContextRoutes.scala
def toHttpRoutes[T : Monoid, F[_]](routes: ContextRoutes[T, F]): HttpRoutes[F]

Converts a ContextRoutes to HttpRoutes.

Converts a ContextRoutes to HttpRoutes. It uses a Monoid.empty to supply a value for the emptyContext. The application of routes is suspended in F to permit more efficient combination of routes via SemigroupK.

Type parameters

F

the effect of the ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes

Value parameters

routes

the ContextRoutes to transform

Attributes

Returns

an ContextRoutes that wraps run

Source
ContextRoutes.scala
def toHttpRoutes[T, F[_]](emptyContext: T)(routes: ContextRoutes[T, F]): HttpRoutes[F]

Converts a ContextRoutes to HttpRoutes.

Converts a ContextRoutes to HttpRoutes. The application of routes is suspended in F to permit more efficient combination of routes via SemigroupK.

Type parameters

F

the effect of the ContextRoutes

T

the type of the context info in the ContextRequest accepted by the ContextRoutes.

Value parameters

emptyContext

the empty context

routes

the ContextRoutes to transform

Attributes

Returns

an ContextRoutes that wraps run

Source
ContextRoutes.scala