Skip to content

FunkyFunctor-Chris/zio-http

 
 

Repository files navigation

ZIO Http

ZIO Http is a scala library for building http apps. It is powered by ZIO and netty and aims at being the defacto solution for writing, highly scalable and performant web applications using idiomatic scala.

Check out the full documentation here: Documentation]

Continuous Integration Discord Chat Sonatype Nexus (Releases) Sonatype Nexus (Snapshots) Average time to resolve an issue Open in Visual Studio Code

Table of Contents

Getting Started

A simple Http server can be built using a few lines of code.

import zio._
import zhttp.http._
import zhttp.service.Server

object HelloWorld extends App {
  val app = Http.collect[Request] {
    case Method.GET -> Root / "text" => Response.text("Hello World!")
  }

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

You can checkout more examples in the examples project —

Installation

Setup via build.sbt

libraryDependencies += "io.d11" %% "zhttp"      % "[version]"
libraryDependencies += "io.d11" %% "zhttp-test" % "[version]" % Test

Benchmarks

These are some basic benchmarks of how ZIO Http performs wrt other main-stream libraries.

Benchmark (req/sec) json plain-text
ZIO-Http 700,073.31 719,576.04
Vert.x 644,854.27 707,991.69
Finagle 567,496.97 572,231.69
Play 261,223.68 263,819.25
Http4s 135,565.22 139,573.98

More details are available here.

About

A scala library to write Http apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%