Finch.io v0.26.0 Release Notes

Release Date: 2018-11-15 // over 5 years ago
  • ๐Ÿš€ finch-* Release (Twitter Futures)

    • โšก๏ธ We have updated to Twitter Utils and Finagle 18.11.0

    ๐Ÿš€ finchx-* Release (Cats Effect)

    โšก๏ธ Backwards Compatibility Updates

    ๐Ÿ‘€ One of the biggest concerns with moving to cats-effect in 0.25 was the lack of backwards compatibility with existing Future-based endpoints (both Scala and Twitter implementations). This version eases that transition by adding support for both Scala and Twitter futures in the Mapper. See #1016 for more details.

    scala\> import io.finch.\_, io.finch.catsEffect.\_scala\> import com.twitter.util.Futurescala\> val foo = get(pathEmpty) { Future.value(Ok("foo")) } \<console\>:18: warning: method mapperFromFutureOutputValue in trait HighPriorityMapperConversions is deprecated (since 0.25.0): com.twitter.util.Future use is deprecated in Endpoints. Consider to use cats-effect compatible effect val foo = get(pathEmpty) { Future.value(Ok("foo")) } ^ foo: io.finch.Endpoint[cats.effect.IO,String] = GET /
    

    NOTE: The foo endpoint is still structured as Endpoint[cats.effect.IO, String]. Both Scala and Twitter Futures are converted to IO when endpoints are mapped.

    ๐Ÿ‘ Stewarding a better Environment

    ๐Ÿš€ In the past, we've gotten a fair number of Github issues and Gitter messages about getting dependencies up to date. With this release we have enabled Scala Steward which makes PRs to update versions of dependencies. A huge thanks to @fthomas for creating this tool and to @travisbrown for adding this to our main repository. We are looking into adding it into our other repositories from the Finch Org.

    ๐Ÿฑ Serving Static Assets

    ๐Ÿ‘€ We're not about telling you not to do something with Finch, only that you can do things with Finch. In this vein, you probably shouldn't serve static assets from the classpath or a file from Finch (or really any HTTP library that isn't designed for serving static assets). But we've added Endpoint.classpathAsset and Endpoint.filesystemAssert that let you do just that. Please, try not to use this in a production environment as it will never match the throughput of what static server. See #1017 for more details.

    scala\> import io.finch.\_, io.finch.catsEffect, scala\> import cats.effect.{IO, ContextShift} scala\> import scala.concurrent.ExecutionContextscala\> implicit val S: ContextShift[IO] = IO.contextShift(ExecutionContext.global)S: cats.effect.ContextShift[cats.effect.IO] = cats.effect.internals.IOContextShift@641d5285 scala\> val index = classpathAsset("/index.html") index: io.finch.Endpoint[cats.effect.IO,com.twitter.io.Buf] = GET /index.html :: io.finch.endpoint.package$FromInputStream@63905eda scala\> index.toServiceAs[Text.Html] res3: com.twitter.finagle.Service[com.twitter.finagle.http.Request,com.twitter.finagle.http.Response] = io.finch.ToService$$anon$4$$anon$2
    

    Gitter8

    We now have a basic gitter8 template to get new projects started fast (thanks to @vkostyukov). Just run sbt new finch/finch.g8 to get started.

    Other Changes

    • ๐Ÿ‘€ Endpoint now has an pathEmpty method which matches an empty path string (see #1015)
    • โšก๏ธ We have updated to Twitter Utils and Finagle 18.11.0 (see #1033)
    • ๐Ÿ‘€ Our version badge now points at Scala Index (see #1010)
    • ๐Ÿ‘€ Endpoint.pathAny now properly captures the matched Trace (see #1017)
    • ๐Ÿ‘€ We refined our Todo App example with the new shiny UI and tests (see #1020)