final class Routes[-Env, +Err] extends AnyRef

Represents a collection of routes, each of which is defined by a pattern and a handler. This data type can be thought of as modeling a routing table, which decides where to direct every endpoint in an API based on both method and path of the request.

When you are done building a collection of routes, you typically convert the routes into an zio.http.HttpApp value, which can be done with the toHttpApp method.

Routes may have handled or unhandled errors. A route of type Route[Env, Throwable], for example, has not handled its errors by converting them into responses. Such unfinished routes cannot yet be converted into zio.http.HttpApp values. First, you must handle errors with the handleError or handleErrorCause methods.

Self Type
Routes[Env, Err]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Routes
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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]

    Returns the concatenation of these routes with the specified routes.

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

    Prepends the specified route to this collection of routes.

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

    Appends the specified route to this collection of routes.

  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def @@[Env1 <: Env](aspect: Middleware[Env1]): Routes[Env1, Err]
  8. def asEnvType[Env2](implicit ev: <:<[Env2, Env]): Routes[Env2, Err]
  9. def asErrorType[Err2](implicit ev: <:<[Err, Err2]): Routes[Env, Err2]
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  15. def handleError(f: (Err) => Response)(implicit trace: Trace): Routes[Env, Nothing]

    Handles all typed errors in the routes by converting them into responses.

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

  17. def handleErrorCauseZIO(f: (Cause[Err]) => ZIO[Any, Nothing, Response])(implicit trace: Trace): Routes[Env, Nothing]
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  23. def provideEnvironment(env: ZEnvironment[Env]): Routes[Any, Err]

    Returns new routes that have each been provided the specified environment, thus eliminating their requirement for any specific environment.

  24. val routes: Chunk[Route[Env, Err]]
  25. 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.

  26. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  27. def timeout(duration: zio.Duration)(implicit trace: Trace): Routes[Env, Err]

    Returns new routes that are all timed out by the specified maximum duration.

  28. def toHttpApp(implicit ev: <:<[Err, Response]): HttpApp[Env]

    Converts the routes into an app, which can be done only when errors are handled and converted into responses.

  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. def transform[Env1](f: (Handler[Env, Response, Request, Response]) => Handler[Env1, Response, Request, Response]): Routes[Env1, Err]

    Returns new routes whose handlers are transformed by the specified function.

  31. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

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

Inherited from AnyRef

Inherited from Any

Ungrouped