Skip to content

Commit

Permalink
fix(Endpoint): fix endpoint example
Browse files Browse the repository at this point in the history
  • Loading branch information
D11Kaushik authored and amitksingh1490 committed Dec 9, 2021
1 parent 492c48c commit c054753
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions example/src/main/scala/example/Endpoints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@ package example

import zhttp.endpoint._
import zhttp.http.Method.GET
import zhttp.http.{HttpApp, Response}
import zhttp.http.Response
import zhttp.service.Server
import zio.{App, ExitCode, URIO}

object Endpoints extends App {
def h1 = GET / "a" / *[Int] / "b" / *[Boolean] to { a =>
def app = GET / "a" / *[Int] / "b" / *[Boolean] to { a =>
Response.text(a.params.toString)
}

def h2 = GET / *[Int] / "b" / *[Boolean] to { a =>
Response.text(a.params.toString)
}

def app: HttpApp[Any, Throwable] = h1 ++ h2

// Run it like any simple app
override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] =
Server.start(8090, app).exitCode
Server.start(8091, app).exitCode
}

0 comments on commit c054753

Please sign in to comment.