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]
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Routes
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Routes(routes: Chunk[Route[Env, Err]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. 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.

  4. def +:[Env1 <: Env, Err1 >: Err](route: Route[Env1, Err1]): Routes[Env1, Err1]

    Prepend the specified route to this HttpApp

  5. def :+[Env1 <: Env, Err1 >: Err](route: Route[Env1, Err1]): Routes[Env1, Err1]

    Appends the specified route to this HttpApp

  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def @@[Env0]: Routes.ApplyContextAspect[Env, Err, Env0]
  8. def @@[Env0, Ctx <: Env](aspect: HandlerAspect[Env0, Ctx])(implicit tag: Tag[Ctx]): Routes[Env0, Err]
  9. def @@[Env0](aspect: HandlerAspect[Env0, Unit]): Routes[Env with Env0, Err]
  10. def @@[Env1 <: Env](aspect: Middleware[Env1]): Routes[Env1, Err]
  11. 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.

  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  16. 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.

  17. 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.

  18. 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.

  19. 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.

  20. 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.

  21. 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.

  22. def handleErrorZIO(f: (Err) ⇒ ZIO[Any, Nothing, Response])(implicit trace: Trace): Routes[Env, Nothing]
  23. 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.

  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. 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

  26. 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

  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. def nest(prefix: PathCodec[Unit])(implicit trace: Trace, ev: <:<[Err, Response]): Routes[Env, Err]
  29. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  31. 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.

  32. val routes: Chunk[Route[Env, Err]]
  33. 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]
  34. def run(request: Request)(implicit trace: Trace): ZIO[Env, Either[Err, Response], Response]
  35. def runZIO(request: Request)(implicit ev: <:<[Err, Response]): ZIO[Env, Nothing, Response]

    An alias for apply.

  36. 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.

  37. 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

  38. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  39. 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.

  40. def toHandler(implicit ev: <:<[Err, Response]): Handler[Env, Nothing, Request, Response]

    Converts the HTTP application into a request handler.

  41. 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.

  42. def tree(implicit trace: Trace, ev: <:<[Err, Response]): Tree[Env]

    Accesses the underlying tree that provides fast dispatch to handlers.

  43. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped