github finagle/finch 0.16.0-M3
Finch 0.16-M3

latest releases: v0.34.1, v0.34.0, v0.33.0...
6 years ago

Another (hopefully the last one) milestone release before 0.16. This time with Scala Futures syntax support.

Scala Syntax Support

In #834, @imliar suggested a new type-class, ToTwitterFuture to abstract over a concrete IO primitive powering endpoint's asynchrony. Right now there are only Scala Futures instances available for ToTwitterFuture, but one can imagine this approach to be scaled to any Futures implementations available for Scala.

Importing io.finch.syntax.scala._ allows to scala.concurrent.Future from within endpoints (assuming ExecutionContext is available in the scope).

import io.finch._, io.finch.syntax.scala._
import scala.concurrent.{Future, ExecutionContext.Implicits.global}

scala> val e = get("foo") { Future.successful(Ok("bar")) }
e: io.finch.Endpoint[String] = GET /foo

scala> e(Input.get("/foo")).awaitValueUnsafe()
res0: Option[String] = Some(bar)

Deprecations

Old-style path matchers such as int, string, boolean, etc are being deprecated in favor of more explicit path[Int], path[String], path[Boolean] and so on. We believe new API will make path matchers more discoverable and easier to reason about. See #844 for more context.

Dependencies

  • Finagle has been bumped to 7.1 (see #842)

Don't miss a new finch release

NewReleases is sending notifications on new releases.