1. 22
  1.  

  2. 3

    @kevincox really interesting write-up. I’m glad it was shared again.

    It’s often a shame that these “minimal frameworks” we can come up with can’t more easily become widespread, because it’s often just a collection of language patterns.

    Happy new year!

    1. 2

      Yeah. It is nice when you have solid building blocks and can make some sort of “framework” for your own application. I love the idea of ready-to-go frameworks where I can truly just focus on the app logic but it seems that there are always tradeoffs. I know that personally I am always attracted to the ability to put in a bit of elbow grease and get exactly what I need.

    2. 3

      For example the following routes conflict and require manual ordering to resolve.

      • `/email/remove?<proof>ˋ
      • ˋ/email/remove?<unsubscribe>ˋ

      I don’t use Rust nor Rocket but that seems sane to me. What should happen if both ˋproofˋ and ˋunsubscribe` are provided? I don’t think the router should rely solely on the declaration order in this case (and maybe Rocket can’t do that if it uses some kind of parallelism for route matching). Forcing to declare a rank mitigates all the issues. But maybe I’m missing something related to the typings? I didn’t really understand the next line about Option.

      1. 1

        That’s a good point. Personally I would be ok throwing a Bad Request or something but I can see how it isn’t clear what should happen if both are provided.

        Declaring a parameter as Option<&str> makes the parameter optional. If both were optional then it isn’t clear what route would be taken if neither argument was passed.

      2. 2

        It’s been some time since I’ve used Rocket, but you probably should’ve been using fairings.

        1. 3

          I’m the author.

          I don’t really see how that would have helped here. Fairings only wrap the request so they have the same problems that the “pre” logic can’t get any runtime parameters from the route and that the “post” logic only happens after everything has been executed. (Which at least for the ETag problem means that you can’t save the work of generating the body).