(it seems like a little thing but it has implications for how you write your entire application.)
-
Show this thread
-
tide has what i’d like to see, really – return a value from a handler, make sure the value implements the IntoResponse trait
1 reply 1 retweet 4 likesShow this thread -
this is attainable in JS too. The ServiceWorkers spec has you instantiating Response types that have status, headers, and a body which can be an opaque-to-js stream
2 replies 0 retweets 2 likesShow this thread -
Replying to @isntitvacant
I had heavily considered this when writing the second version of take-five (which uses entirely promised-based route handlers), but I wasn't sure how you'd signal to the framework "i'm done processing this request" (allowing you to short-circuit middleware processing)
2 replies 0 retweets 1 like -
Replying to @whale_eat_squid
I landed on “it’s important to maintain the invariant that all middleware runs in order” & dropped the constraint that the application be able to opt out of further processing.
2 replies 0 retweets 1 like -
Replying to @isntitvacant
interesting. i ended up "dropping" middleware -- routes are arrays of async funs you run (and they run in order thanks to how js ends up processing arrays). you can short-circuit this by either calling a function on the `ctx` object to emit a value or not return a then-able
1 reply 0 retweets 1 like -
Replying to @whale_eat_squid
I went the route of saying “per handler middleware should be implemented as a higher order function”, ripped off from Django ca. v1.19 days
2 replies 0 retweets 2 likes -
Replying to @isntitvacant
lol just looked up tide and of course
@yoshuawuyts is involved. i swear they're like 5 miles ahead of where ever i am1 reply 0 retweets 2 likes -
Replying to @whale_eat_squid @isntitvacant
Haha, hi! :D Also in case you missed it: a big Tide rewrite was PRd last Thursday https://github.com/rustasync/tide/pull/156 …. It'll hopefully smooth out some of the bumps Tide has, making it a lot easier to use. If you have any thoughts on it, we'd love to hear them!
1 reply 0 retweets 1 like -
Replying to @yoshuawuyts @whale_eat_squid
oh i was thinking in particular of this PR. such great work, & so well explained!

1 reply 0 retweets 1 like
Yay, glad to hear you're into the new design! I'll pass the feedback along to the rest of the team ^^
-
-
Replying to @yoshuawuyts @whale_eat_squid
Something I noticed while working on spife that _might_ be useful for tide: defining body processing as a middleware lifecycle (That way you could define separate middleware for handling JSON / multipart / body length & mix and match at the app level)
1 reply 0 retweets 1 like -
Replying to @isntitvacant @whale_eat_squid
Ohh, interesting! What kind of middleware are you referring to? The concept of extractors still lives on inside the Context argument. E.g. ctx.body_json() can convert the incoming body stream to a typed struct. And it can be extended with custom impls! Or is that different?
1 reply 0 retweets 0 likes - 6 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.