final case class Routes[-Env, +Err](routes: Chunk[Route[Env, Err]]) extends Product with Serializable
An HTTP application is a collection of routes, all of whose errors have been handled through conversion into HTTP responses.
HTTP applications can be installed into a zio.http.Server, which is capable of using them to serve requests.
- Self Type
- Routes[Env, Err]
- Alphabetic
- By Inheritance
- Routes
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
++[Env1 <: Env, Err1 >: Err](that: Routes[Env1, Err1]): Routes[Env1, Err1]
Combines this HTTP application with the specified HTTP application.
Combines this HTTP application with the specified HTTP application. In case of route conflicts, the routes in this HTTP application take precedence over the routes in the specified HTTP application.
-
def
+:[Env1 <: Env, Err1 >: Err](route: Route[Env1, Err1]): Routes[Env1, Err1]
Prepend the specified route to this HttpApp
-
def
:+[Env1 <: Env, Err1 >: Err](route: Route[Env1, Err1]): Routes[Env1, Err1]
Appends the specified route to this HttpApp
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def @@[Env0]: Routes.ApplyContextAspect[Env, Err, Env0]
- def @@[Env0, Ctx <: Env](aspect: HandlerAspect[Env0, Ctx])(implicit tag: Tag[Ctx]): Routes[Env0, Err]
- def @@[Env0](aspect: HandlerAspect[Env0, Unit]): Routes[Env with Env0, Err]
- def @@[Env1 <: Env](aspect: Middleware[Env1]): Routes[Env1, Err]
-
def
apply(request: Request)(implicit ev: <:<[Err, Response]): ZIO[Env, Response, Response]
Executes the HTTP application with the specified request input, returning an effect that will either succeed or fail with a Response.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
handleError(f: (Err) ⇒ Response)(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors in the routes by converting them into responses.
Handles all typed errors in the routes by converting them into responses. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
-
def
handleErrorCause(f: (Cause[Err]) ⇒ Response)(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors, as well as all non-recoverable errors, by converting them into responses.
Handles all typed errors, as well as all non-recoverable errors, by converting them into responses. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
-
def
handleErrorCauseZIO(f: (Cause[Err]) ⇒ ZIO[Any, Nothing, Response])(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response.
Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
-
def
handleErrorRequest(f: (Err, Request) ⇒ Response)(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors in the routes by converting them into responses, taking into account the request that caused the error.
Handles all typed errors in the routes by converting them into responses, taking into account the request that caused the error. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
-
def
handleErrorRequestCause(f: (Request, Cause[Err]) ⇒ Response)(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors in the routes by converting them into responses, taking into account the request that caused the error.
Handles all typed errors in the routes by converting them into responses, taking into account the request that caused the error. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
-
def
handleErrorRequestCauseZIO(f: (Request, Cause[Err]) ⇒ ZIO[Any, Nothing, Response])(implicit trace: Trace): Routes[Env, Nothing]
Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response, taking into account the request that caused the error.
Handles all typed errors, as well as all non-recoverable errors, by converting them into a ZIO effect that produces the response, taking into account the request that caused the error. This method can be used to convert routes that do not handle their errors into ones that do handle their errors.
- def handleErrorZIO(f: (Err) ⇒ ZIO[Any, Nothing, Response])(implicit trace: Trace): Routes[Env, Nothing]
-
def
isDefinedAt(request: Request)(implicit ev: <:<[Err, Response]): Boolean
Checks to see if the HTTP application may be defined at the specified request input.
Checks to see if the HTTP application may be defined at the specified request input. Note that it is still possible for an HTTP application to return a 404 Not Found response, which cannot be detected by this method. This method only checks for the presence of a handler that handles the method and path of the specified request.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mapError[Err1](fxn: (Err) ⇒ Err1): Routes[Env, Err1]
Allows the transformation of the Err type through a function allowing one to build up a HttpApp in Stages delegates to the Route
-
def
mapErrorZIO[Err1](fxn: (Err) ⇒ ZIO[Any, Err1, Response])(implicit trace: Trace): Routes[Env, Err1]
Allows the transformation of the Err type through an Effectful program allowing one to build up a HttpApp in Stages delegates to the Route
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nest(prefix: PathCodec[Unit])(implicit trace: Trace, ev: <:<[Err, Response]): Routes[Env, Err]
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
def
provideEnvironment(env: ZEnvironment[Env]): Routes[Any, Err]
Provides the specified environment to the HTTP application, returning a new HTTP application that has no environmental requirements.
- val routes: Chunk[Route[Env, Err]]
- def run(method: Method = Method.GET, path: Path = Path.root, headers: Headers = Headers.empty, body: Body = Body.empty)(implicit ev: <:<[Err, Response]): ZIO[Env, Nothing, Response]
- def run(request: Request)(implicit trace: Trace): ZIO[Env, Either[Err, Response], Response]
-
def
runZIO(request: Request)(implicit ev: <:<[Err, Response]): ZIO[Env, Nothing, Response]
An alias for
apply. -
def
sandbox(implicit trace: Trace): Routes[Env, Nothing]
Returns new routes that automatically translate all failures into responses, using best-effort heuristics to determine the appropriate HTTP status code, and attaching error details using the HTTP header
Warning. -
def
serve[Env1 <: Env](implicit ev: <:<[Err, Response], trace: Trace, tag: zio.EnvironmentTag[Env1]): URIO[Env1 with Server, Nothing]
A shortcut for
Server.install(routes) *> ZIO.never -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
timeout(duration: zio.Duration)(implicit trace: Trace): Routes[Env, Err]
Returns a new HTTP application whose requests will be timed out after the specified duration elapses.
-
def
toHandler(implicit ev: <:<[Err, Response]): Handler[Env, Nothing, Request, Response]
Converts the HTTP application into a request handler.
-
def
transform[Env1](f: (Handler[Env, Response, Request, Response]) ⇒ Handler[Env1, Response, Request, Response]): Routes[Env1, Err]
Returns new new HttpApp whose handlers are transformed by the specified function.
-
def
tree(implicit trace: Trace, ev: <:<[Err, Response]): Tree[Env]
Accesses the underlying tree that provides fast dispatch to handlers.
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )