-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e4f6bf
commit a236750
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
a236750
There was a problem hiding this comment.
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
a236750
There was a problem hiding this comment.
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
a236750
There was a problem hiding this comment.
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