Skip to content

Commit

Permalink
Request Streaming Example
Browse files Browse the repository at this point in the history
  • Loading branch information
amitksingh1490 committed Mar 2, 2022
1 parent 8e4f6bf commit a236750
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions example/src/main/scala/example/RequestStreaming.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package example

import zhttp.http._
import zhttp.service.Server
import zio._
object RequestStreaming extends App {

// Create HTTP route which echos back the request body as Stream
val app: HttpApp[Any, Nothing] = Http.collect[Request] { case req @ Method.POST -> !! / "echo" =>
Response(data = HttpData.fromStream(req.bodyAsStream))
}

// Run it like any simple app
override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] =
Server.start(8090, app).exitCode
}

3 comments on commit a236750

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 960827.60

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 990754.48

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 972533.41

Please sign in to comment.