Ktor vs http4k

My exploration of JetBrains’ HTTP library concludes today with a comparison of the same functionality implemented with Ktor (https://ktor.io/) and http4k (https://http4k.org)

That’s it really. Please watch it to the end and let me know in the comments if you agree with my conclusions.

In this episode

  • 00:00:00 Review
  • 00:02:28 Create a function to create the routes
  • 00:03:35 IntelliJ refactoring internal error
  • 00:04:23 Bind our first handler to GET /customer
  • 00:06:32 http4k JSON support
  • 00:08:16 Bind a handler to GET /customer/{id}
  • 00:10:17 Some trouble binding to a path with no id
  • 00:12:00 Fudge that
  • 00:12:38 A handler for delete by ID
  • 00:14:55 Another route matching differences between Ktor and http4k
  • 00:16:05 Finally a POST for adding a customer
  • 00:18:53 Finally another error case, this time we need to catch
  • 00:20:47 Check the tests
  • 00:21:12 Compare and contrast our two app versions

This video is in a playlist of Ktor episodes (https://www.youtube.com/playlist?list=PL1ssMPpyqochUiQEM9PZ_P-9CbV1Il81B) and http4k (https://www.youtube.com/playlist?list=PL1ssMPpyqocg5TKqmiGWlvi3O5L8XPe8Q)

If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (http://java-to-kotlin.dev). It’s about far more than just the syntax differences between the languages – it shows how to upgrade your thinking to a more functional style.

submitted by /u/dmcg
[link] [comments]