Http4s Scala Tutorial: Writing an HTTP Server with Purely Functional Scala

Поділитися
Вставка
  • Опубліковано 6 січ 2025

КОМЕНТАРІ • 55

  • @georgezorikov3075
    @georgezorikov3075 3 роки тому +2

    Wow, I literally started writing my http4s hello world app a week ago. Very convenient! Thank you

  • @PawanKumar-kj8oo
    @PawanKumar-kj8oo 3 роки тому +2

    Great tutorial as usual. I was shying away from http4s (instead of using play framework) because of its complexity but now it makes total sense to use it.

    • @rockthejvm
      @rockthejvm  3 роки тому +1

      Glad it clicked!

    • @DinoFancellu
      @DinoFancellu 3 роки тому +2

      Definitely move towards http4s. Play is stuck in the past with Futures, zero sign of moving away from them. I say this as a long time Scala Play dev.

  • @ivanvelikanova9950
    @ivanvelikanova9950 3 роки тому +1

    thank you so much for this video. Scala-type system, implicits etc. are blowing my head ... i didn't get time to complete this video yet, hope to finish this soon .... but this is next level.

  • @OxMiroslav
    @OxMiroslav 3 роки тому +4

    Finally http4s ! Thank you for that. I didn't find any good resource to learn it.

  • @Elodius2
    @Elodius2 Рік тому +1

    You're the best, Daniel!

  • @abhishes
    @abhishes 3 роки тому +7

    This is amazing!!! thank you for doing this!!!

  • @estebanmarin002
    @estebanmarin002 2 роки тому +1

    Thanks for this video. Really help me to digest the HTTP library

  • @piotr2951
    @piotr2951 2 роки тому

    Amazing crash curse. Looking forward to the cats introduction

  • @alanlewis1625
    @alanlewis1625 3 роки тому +6

    Daniel, another terrific video. Thank you. I think it could be slightly improved by having a (very simple) database implementation, rather than a Map. Yes, I realise the extra effort involved, and it would have made the video longer, but it would add a realistic scenario. Or, perhaps another video with a "simplistic" storage and retrieval from a table? Perhaps making use of JDBC or JOOQ? Thanks again for all your efforts.

    • @rockthejvm
      @rockthejvm  3 роки тому +5

      Glad you liked it! I wanted to keep this specific to http4s - I'll add full-blown projects on my site soon.

  • @ohngec07
    @ohngec07 2 роки тому

    Great video!
    Should have watched this before I spent hours banging my head against the http4s documentation lol

  • @RenatoRaeffrayBarbosa
    @RenatoRaeffrayBarbosa 2 роки тому +2

    Great video, Daniel! I'm looking information on how to get repeated query parameters in Scala http4s/dsl. Or even get all parameters and handle it. Do you know how we could achieve it? This is pretty silly thing in other languages, such python or java, but in scala looks like quite convolute. Thank you buddy!

    • @rockthejvm
      @rockthejvm  2 роки тому

      OptionalMultiQueryParamDecoderMatcher. The difference from the video is "Multi".

  • @nayak232
    @nayak232 3 роки тому +5

    Do you plan to have any tutorials on scala.js

    • @rockthejvm
      @rockthejvm  3 роки тому

      Something in particular you're interested in?

    • @PawanKumar-kj8oo
      @PawanKumar-kj8oo 3 роки тому +1

      @@rockthejvm Use common / shared case classes in http4s server and scalajs client (maybe using laminar lib)

  • @shyam2305
    @shyam2305 3 роки тому +1

    Great tutorial. Covers important areas about encoding/decoding of URL points. Error handling with 'year' was too short and quick, IMO. Could be elaborated a bit more. 3rd requirement to POST (create) director is missed. What is the idea behind having HttpRoutes as typed to F[_] : Monad instead of IO ? HttpRoutes is anyways tied to cats provided Monad. So, what is the advantage? Thanks a lot for all your efforts.

    • @rockthejvm
      @rockthejvm  3 роки тому

      Will cover more in-depth in a course!

  • @mrajug
    @mrajug Рік тому +1

    Excellent tutorial. thanks

  • @cavidxalilov2968
    @cavidxalilov2968 2 роки тому

    thank you for perfect tutorial.
    but it does not compile.
    maybe I do smth wrong.
    Error: could not find implicit value for parameter encoder: io.circe.Encoder[cats.effect.IO[cats.effect.IO[Option[String]]]]

  • @apratimtiwari
    @apratimtiwari Місяць тому

    Could you please help with POST? I am unable to decode a particular request using circe or native http4s jackson library.

    • @apratimtiwari
      @apratimtiwari Місяць тому

      I found the answer in your blog post :) !!! Thank you so much.

  • @sergeibatiuk3468
    @sergeibatiuk3468 2 роки тому

    Are actors in the tutorial typed?

  • @reddot_22
    @reddot_22 Рік тому

    is there solid JWT or OAuth for http4s? I always feel security is left on such a mist of bad documentation.

    • @rockthejvm
      @rockthejvm  Рік тому +1

      Try tsec: jmcardon.github.io/tsec/docs/http4s-auth.html

    • @reddot_22
      @reddot_22 Рік тому

      @@rockthejvm Thank you King 🙏🙌

  • @АлександрКлёвый-г2б
    @АлександрКлёвый-г2б 9 місяців тому

    Это просто о...но!
    Daniel,
    what do you think about Rust & Go?
    It will be pretty cool oneday to see some technical tutorials from you about both of this!

  • @M4rvin66
    @M4rvin66 2 роки тому

    What would be an alternative to Cats IO? Is the use of tagless final and higher kinded types really helpful here?

    • @rockthejvm
      @rockthejvm  2 роки тому

      There's Option, Either, monad transformers, ZIO

  • @BloodnutXcom
    @BloodnutXcom 3 роки тому +3

    While I appreciate the type class abstraction to support an effect monad, I have to say that it makes for horrendous boilerplate code.
    And not only just carrying that F[_]: MONAD everywhere, but also the dsl imports, asJson calls without the option to declare a default serializer and even the final ".resource.use(never)" is just meh and should have been simplified under some "run" method.
    The first time I needed to use http4s I was relatively new to cats ecosystem and had to use ZIO monad with it. That was a lesson in frustration.

    • @rockthejvm
      @rockthejvm  3 роки тому +3

      I empathize. This is why I shot this video, to ease the frustration for beginners.

    • @BloodnutXcom
      @BloodnutXcom 3 роки тому +1

      @@rockthejvm hopefully ZIO-WEB comes around soon to be a adequate replacement

  • @ThesamBETH
    @ThesamBETH 3 роки тому

    Thanks very much for this tutorial.

  • @dmitrytrofimenko4419
    @dmitrytrofimenko4419 3 роки тому

    Awesome. Like, subscribing. Keep doing, fellow

  • @krasavchikable
    @krasavchikable 3 роки тому +1

    Good, but too simple video.
    I would like to know http4s deep, best practices and so on.
    I hoped you write mini app as microservice in full fp way with movie/director repository, some other services, then you combine all this services and http4s.
    I wait next episode.

    • @rockthejvm
      @rockthejvm  3 роки тому +2

      In-depth stuff is coming too on my site: rockthejvm.com

  • @lovejohnson5426
    @lovejohnson5426 3 роки тому

    This is amazing

  • @afiefsholichuddin
    @afiefsholichuddin 3 роки тому

    Is there a way to simplify those route handler? maybe an episode 2 for this? :D

    • @rockthejvm
      @rockthejvm  3 роки тому +1

      What else would you like to see?

    • @afiefsholichuddin
      @afiefsholichuddin 3 роки тому

      @@rockthejvm maybe a "simplified" route handler with for comprehention? Not sure if that possible, I am still learning scala fp 😅

  • @bilalf
    @bilalf 3 роки тому

    Thank you!!

  • @peterstorm_io
    @peterstorm_io 3 роки тому +3

    Awesome tutorial, though I'm sad you call the functions "magic", as they are well... just functions. When you do Play, or Spring, or almost any other server framework, those _are_ using magic, with their annotations... http4s is not :D

    • @rockthejvm
      @rockthejvm  3 роки тому

      Sufficiently advanced magic becomes indistinguishable from technology.

  • @theMarhaenist
    @theMarhaenist 3 роки тому +1

    http4s = "http for (4) scala"