GithubHelp home page GithubHelp logo

drruisseau / zio-http Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zio/zio-http

0.0 1.0 0.0 2.78 MB

A scala library to write Http apps.

Home Page: https://dream11.github.io/zio-http

License: MIT License

Scala 100.00%

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.

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
}

Examples

You can checkout more examples in the example project โ€”

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: 8090.
  3. Send curl request for defined http Routes, for eg : curl -i "http://localhost:8090/text" for example.HelloWorld.

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.

zio-http's People

Contributors

tusharmath avatar d11-amitsingh avatar scala-steward avatar amitksingh1490 avatar shrutiverma97 avatar girdharshubham avatar dinojohn avatar gciuloaica avatar smehta91d11 avatar d11kaushik avatar declspec-cdecl avatar jgoday avatar rpiotrow avatar ashprakasan avatar frekw avatar smehta91 avatar sumawa avatar whiskeylips avatar davidhoyt avatar svenw avatar sh0hei avatar brbrown25 avatar zsfvishnu-d11 avatar ayakovlenko avatar sheldonjms avatar virdis avatar morozov11 avatar yuk1ty avatar tdrozdowski avatar sushengloong avatar

Watchers

 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.