Wish more modules would expose a `function (req, res) {}` interface. Perhaps with `, next)` too. We need more composable HTTP modules
-
Show this thread
-
Replying to @yoshuawuyts
that interface has a problem, as it assumes you attaching info to req/res. It’s an antipattern for perf code in. V8.
2 replies 0 retweets 1 like -
Replying to @matteocollina @yoshuawuyts
This is why I really like `(ctx) => {}` (e.g. `function ({req, res, next, ...meta}) { }` )
1 reply 0 retweets 1 like -
-
Replying to @yoshuawuyts @davidmarkclem
all things that you’ll be attaching to req/rea
1 reply 0 retweets 2 likes -
Hang on, so you'd have ctx and meta? Or are those two interchangeable?
1 reply 0 retweets 3 likes -
unclear pseudo-syntax on my part, but `...meta` in my head, is merging the meta data into `ctx` so `ctx` would have extra props for meta
1 reply 0 retweets 2 likes -
Replying to @davidmarkclem @_lrlna and
So instead of causing deopts by changing req/res you'd be causing them by changing ctx?
1 reply 0 retweets 0 likes
Nah, you can be in control of the prototype that's passed around as ctx - consistent types makes for a happy v8. Harder to do for builtins.
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.