Coder Social home page Coder Social logo

ruurtjan / 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 3.45 MB

A scala library to write Http apps.

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

License: MIT License

Shell 0.21% Scala 99.68% Dockerfile 0.11%

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.http._
import zio.http.Server
import zio._

object HelloWorld extends ZIOAppDefault {

  val app: HttpApp[Any, Nothing] = Http.collect[Request] {
    case Method.GET -> !! / "text" => Response.text("Hello World!")
  }

  override val run =
    Server.start(8090, app)
}

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

Stable

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

Snapshot

libraryDependencies += "dev.zio" %% "zio-http" % "[version]"

NOTE: ZIO Http is compatible with ZIO 1.x and ZIO 2.x.

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

987nabil avatar adamgfraser avatar afsalthaj avatar amitksingh1490 avatar ashprakasan avatar d11-amitsingh avatar d11kaushik avatar declspec-cdecl avatar dependabot[bot] avatar devsprint avatar dinojohn avatar frekw avatar gciuloaica avatar girdharshubham avatar jdegoes avatar jgoday avatar kitlangton avatar nartamonov avatar rajcspsg avatar renovate[bot] avatar rpiotrow avatar scala-steward avatar scottweaver avatar shrutiverma97 avatar smehta91d11 avatar sumawa avatar swoogles avatar tusharmath 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.