Skip to content

codingismy11to7/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 example project —

Installation

Setup via build.sbt

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

NOTE: Currently ZIO Http is compatible with ZIO 1.x only. The library will migrate to ZIO 2.x as soon as a stable release is published.

Watch Mode

You can use the sbt-revolver plugin to start the server and run it in watch mode using ~ reStart command on the SBT console.

About

A scala library to write Http apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 99.4%
  • HTML 0.6%