HttpRoutes

org.http4s.HttpRoutes$
object HttpRoutes

Functions for creating HttpRoutes kleislis.

Attributes

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

Members list

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

Attributes

Returns

an HttpRoutes that wraps run

Source
HttpRoutes.scala
def empty[F[_] : Applicative]: HttpRoutes[F]

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

Returns

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

Source
HttpRoutes.scala
def strict[F[_] : Applicative](pf: PartialFunction[Request[F], F[Response[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 parameters

F

the base effect of the HttpRoutes

Value parameters

pf

the partial function to lift

Attributes

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