Skip to content
/ zio-http Public
forked from zio/zio-http

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers

License

Notifications You must be signed in to change notification settings

eshu/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.

Development CI Badge Sonatype Releases Sonatype Snapshots javadoc ZIO Http

Installation

Setup via build.sbt:

libraryDependencies += "dev.zio" %% "zio-http" % "3.0.0-RC2"

NOTES ON VERSIONING:

  • Older library versions 1.x or 2.x with organization io.d11 of ZIO Http are derived from Dream11, the organization that donated ZIO Http to the ZIO organization in 2022.
  • Newer library versions, starting in 2023 and resulting from the ZIO organization (dev.zio) started with 0.0.x, reaching 1.0.0 release candidates in April of 2023

Getting Started

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

import zio._
import zio.http._

object HelloWorld extends ZIOAppDefault {

  val app: HttpApp[Any] = 
    Routes(
      Method.GET / "text" -> handler(Response.text("Hello World!"))
    ).toHttpApp

  override val run =
    Server.serve(app).provide(Server.default)
}

Steps to run an example

  1. Edit the RunSettings - modify className to the example you'd like to run.
  2. From sbt shell, run ~example/reStart. You should see Server started on port: 8080.
  3. Send curl request for defined http Routes, for eg : curl -i "http://localhost:8080/text" for example.HelloWorld.

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.

Documentation

Learn more on the ZIO Http homepage!

Contributing

For the general guidelines, see ZIO contributor's guide.

Code of Conduct

See the Code of Conduct

Support

Come chat with us on Badge-Discord.

License

License

About

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 99.8%
  • Other 0.2%