Couldn’t see my current favourite (Gotham) on the list, but maybe next time
-
-
Replying to @Andysomniac
I'd be really interested in seeing how Gotham works out. Personally I think Gotham comes close, but we'll be able to do even better eventually! Dream: for await conn in server { await middleware(&conn)?; await middleware(&conn)?; await router(conn)?; }
1 reply 0 retweets 0 likes -
Replying to @yoshuawuyts @Andysomniac
The step in front of the loop would be a sequence of one-off initializers (e.g. setup db connection, rate limiting). All we'd need to do in the loop is pipe it through the middleware. The router is just another piece of middleware, which inside it can have more middleware :D
1 reply 0 retweets 0 likes -
Replying to @yoshuawuyts
This is pretty much how it works now, will gist you an anonymised snippet of the app I am working on’s router tomorrow when at my machine if you want?
1 reply 0 retweets 1 like -
-
-
-
Replying to @yoshuawuyts
gist (does not contain the imports or the actual routing, but should show the structure): https://gist.github.com/Andy-Bell/d9c8ac72edee30cdad819096c139ed65 …
1 reply 0 retweets 1 like -
-
Replying to @yoshuawuyts
The interesting thing in Gotham is how the middeware layers work. In the above example, it looks like it goes: CORS->Diesel->CurrentUser->Router, but as all middleware is a Future (iirc), it actually functions as CORS->Diesel->CurrentUser->Router->CurrentUser->Diesel->CORS
1 reply 0 retweets 1 like
Ahh yeah, that's v. good. Especially for things like logging & timings.
-
-
Replying to @yoshuawuyts @Andysomniac
Btw, is your CORS code available somewhere? Was trying to check it out, but apparently Gotham doesn't have any yet. Might be a good contrib if you haven't considered it already :D https://github.com/gotham-rs/gotham/issues/119 …
1 reply 0 retweets 0 likes -
Replying to @yoshuawuyts
It is a bit hacky and I am 99% sure it likely has a flaw in it. I was going to rewrite it and contribute it at some point (as this is from a work project I cannot just put it up unfortunately unless I get permission)
1 reply 0 retweets 1 like - 2 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.