Skip to content

Commit

Permalink
small fixes in docs (#2408)
Browse files Browse the repository at this point in the history
* small fixes in docs

* sandbox instead of ignore
  • Loading branch information
TomTriple authored Aug 29, 2023
1 parent ac3e544 commit 82300d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/dsl/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ this for you:

## Special Constructors Handler

These are some special constructors for `Http` and `Handler`:
These are some special constructors for `HttpApp` and `Handler`:

### Handler.ok

Expand Down Expand Up @@ -138,12 +138,12 @@ Before you do this, you must first handle any typed errors produced by your rout

Handling your errors ensures that the clients of your API will not encounter strange and unexpected responses, but will always be able to usefully interact with your web service, even in exceptional cases.

If you wish to convert your errors into `InternalServerError`, without leaking any details on the specific nature of the errors, you can use `Routes#ignore`, and after dealing with your errors in this way, you can convert your routes into an HTTP application.
If you wish to convert your failures automatically into suitable responses, without leaking any details on the specific nature of the errors, you can use `Routes#sandbox`, and after dealing with your errors in this way, you can convert your routes into an HTTP application.

## Running an App

ZIO HTTP server needs an `HttpApp[R]` for running. We can use `Server.serve()` method to bootstrap the server with
an `App[R]`:
an `HttpApp[R]`:

```scala mdoc:silent
object HelloWorld extends ZIOAppDefault {
Expand Down
22 changes: 11 additions & 11 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ The first step when using ZIO HTTP is creating an HTTP app.

## Http and Handler

`Handler` describes the transformation from an incoming `Request` to an outgoing `Response` type. The `Http`
type on top if this provides input-dependent routing to different `Handler` values. There are some default
`Handler` describes the transformation from an incoming `Request` to an outgoing `Response` type. The `HttpApp`
type on top of this provides input-dependent routing to different `Handler` values. There are some default
handler constructors such as `Handler.text`, `Handler.html`, `Handler.fromFile`, `Handler.fromData`, `Handler.fromStream`, `Handler.fromEffect`.

A `Handler` can always be transformed to a `HttpApp` value using the `.toHttpApp` method, in which case the
HTTP application will handle all routes.

### Creating a "_Hello World_" app

Creating an HTTP app using ZIO Http is as simple as given below, this app will always respond with "Hello World!"
Creating an HTTP app using ZIO HTTP is as simple as given below, this app will always respond with "Hello World!"

```scala mdoc:silent
import zio.http._

val app = Handler.text("Hello World!").toHttpApp
```

An application can be made using any of the available operators on `zio.Http`. In the above program for any Http request, the response is always `"Hello World!"`.
An application can be made using any of the available operators on `HttpApp`. In the above program for any Http request, the response is always `"Hello World!"`.

### Routing

Expand Down Expand Up @@ -186,10 +186,10 @@ object HelloWorld extends ZIOAppDefault {

## Examples

- [HTTP Server](https://zio.github.io/zio-http/docs/v1.x/examples/zio-http-basic-examples/http_server)
- [Advanced Server](https://zio.github.io/zio-http/docs/v1.x/examples/advanced-examples/advanced_server)
- [WebSocket Server](https://zio.github.io/zio-http/docs/v1.x/examples/zio-http-basic-examples/web-socket)
- [Streaming Response](https://zio.github.io/zio-http/docs/v1.x/examples/advanced-examples/stream-response)
- [HTTP Client](https://zio.github.io/zio-http/docs/v1.x/examples/zio-http-basic-examples/http_client)
- [File Streaming](https://zio.github.io/zio-http/docs/v1.x/examples/advanced-examples/stream-file)
- [Authentication](https://zio.github.io/zio-http/docs/v1.x/examples/advanced-examples/authentication)
- [HTTP Server](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/HelloWorld.scala)
- [WebSocket Server](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/WebSocketEcho.scala)
- [Streaming Response](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/RequestStreaming.scala)
- [HTTP Client](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/HttpsClient.scala)
- [File Streaming](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/FileStreaming.scala)
- [Authentication](https://github.com/zio/zio-http/blob/main/zio-http-example/src/main/scala/example/AuthenticationServer.scala)
- [All examples](https://github.com/zio/zio-http/tree/main/zio-http-example/src/main/scala/example)

0 comments on commit 82300d1

Please sign in to comment.