Skip to content

Commit

Permalink
Introduce EndpointModule
Browse files Browse the repository at this point in the history
  • Loading branch information
vkostyukov committed Oct 2, 2018
1 parent ec9e236 commit fee0844
Show file tree
Hide file tree
Showing 48 changed files with 1,606 additions and 1,528 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ Hello World!
This "Hello World!" example is built with just `finch-core`.

```scala
import io.finch._, io.finch.syntax._
import io.finch._, cats.effect.IO
import com.twitter.finagle.Http

val api: Endpoint[String] = get("hello") { Ok("Hello, World!") }

Http.server.serve(":8080", api.toServiceAs[Text.Plain])
object Main extends App with Endpoint.Module[IO] {
val api: Endpoint[IO, String] = get("hello") { Ok("Hello, World!") }
Http.server.serve(":8080", api.toServiceAs[Text.Plain])
}
```

See [examples](examples/src/main/scala/io/finch) sub-project for more complete examples.
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/src/main/scala/io/finch/benchmarks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.twitter.finagle.http.{Request, Response}
import com.twitter.io.Buf
import com.twitter.util.{Await, Try}
import io.circe.generic.auto._
import io.finch.catsEffect._
import io.finch.circe._
import io.finch.data.Foo
import java.nio.charset.{Charset, StandardCharsets}
Expand All @@ -19,7 +18,7 @@ import shapeless._
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(2)
abstract class FinchBenchmark {
abstract class FinchBenchmark extends Endpoint.Module[IO] {
val postPayload: Input = Input.post("/").withBody[Text.Plain](Buf.Utf8("x" * 1024))
val getRoot: Input = Input.get("/")
val getFooBarBaz: Input = Input.get("/foo/bar/baz")
Expand Down
Loading

0 comments on commit fee0844

Please sign in to comment.