Coder Social home page Coder Social logo

darkenpeng / zio-http Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zio/zio-http

0.0 0.0 0.0 4.96 MB

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

Home Page: https://zio.dev/zio-http

License: Apache License 2.0

Shell 0.16% Scala 99.77% Dockerfile 0.08%

zio-http's Introduction

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: App[Any] = 
    Http.collect[Request] {
      case Method.GET -> Root / "text" => Response.text("Hello World!")
    }

  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

zio-http's People

Contributors

987nabil avatar adamgfraser avatar afsalthaj avatar amitksingh1490 avatar d11-amitsingh avatar d11kaushik avatar declspec-cdecl avatar dependabot[bot] avatar devsprint avatar dinojohn avatar ex0ns avatar frekw avatar gciuloaica avatar girdharshubham avatar jdegoes avatar khajavi avatar kitlangton avatar nartamonov avatar renovate[bot] avatar scala-steward avatar scottweaver avatar shrutiverma97 avatar smehta91d11 avatar sumawa avatar swoogles avatar tomtriple avatar tusharmath avatar vigoo avatar wosin avatar wpoosanguansit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.