4 ms·
This article makes several different points that would ideally each be tackled on their own. You don't need a router when you have pattern matching (just split
by dakom 2y ago
This article makes several different points that would ideally each be tackled on their own.
You don't need a router when you have pattern matching (just split the url and match on static and dynamic vars however you need)
Auth is typically DIY in any language, or SaaS like Firebase/Auth0. It's not a language or framework problem, necessarily
CSS/JS tooling makes no sense for many frontend Rust frameworks like Dominator, which is in Rust (not JS) and has its own approach to styling that works for it (e.g. attaching styles to signals, so they change on the fly)
I get what the author is saying - in fact I've been around the block a couple times solving all the different points in the article and it is painful. For example, see https://github.com/dakom/dominator-workers-fluent-auth https://github.com/dakom/dominator-workers-fluent-auth which does a lot of the stuff here on the Cloudflare workers framework (also adds another wishlist item - localization with Fluent)
A "batteries included" full framework that does _everything_ is nice to have, but many real-world projects will want to replace those opinionated decisions and go the DIY route anyway. Rust is more than mature enough, even on the frontend web, to tackle all of that - if you know where to look (wasm-bindgen, etc.)
- Daishiman 2y ago> You don't need a router when you have pattern matching (just split the url and match on static and dynamic vars however you need) Web frameworks allow for much more: URL redirections, specific management of append-slash and case-sensitive URLs, complex regex matching, etc. > Auth is typically DIY in any language, or SaaS like Firebase/Auth0. It's not a language or framework problem, necessarily False. Django, Laravel, Rails and batteries-included languages have really good auth management. I personally consider it a gigantic mistake in 90% of orgs to outsource auth to external parties. The ability for experienced web devs to just hit the ground running and have 10 basic CRUDs running in a single day because they don't have to deal with this needless complexity is simply amazing for small businesses.
- dakom 2y ago> URL redirection Erm, just return a new url after the match? Get fancy with state machine like enums? Rust has everything you need here, not getting why you think this requires a framework. > Specific management of [...] again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done in a line or two of code > complex regex matching erm, regex crate? > Django, Laravel, Rails Yup, those are valid choices. I said it's not a framework problem necessarily. Not a one size fits all sorta problem. Wordpress is also a fine choice if your business is knocking out new sites for a new client every month. But, if you're building a single product over the course of a year or two, it's not the end of the world to spend a couple weeks rolling your own auth and hook it up to transactional emails and everything else. It's just one small problem to deal with, not major in the grand scheme of things. YMMV
- Daishiman 2y ago> Rust has everything you need here, not getting why you think this requires a framework. Because you're reinventing a wheel that doesn't need reinvention, and the most likely thing is that you will neither reinvent it nor pick the best library that an opinionated framework with hundreds of eyeballs has. > again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done in a line or two of code Sufficiently large and complex websites will have that need. > But, if you're building a single product over the course of a year or two, it's not the end of the world to spend a couple weeks rolling your own auth and hook it up to transactional emails and everything else. It's just one small problem to deal with, not major in the grand scheme of things. YMMV No individual problem is large, but it is objectively a dozen little problems, all with a nontrivial chance to blow up into larger problems. Code reuse and frameworks exist because, unless you've been doing web development for a long time, you _will_ run into issues that have already been solved.
- dakom 2y agoI don't think you get how powerful Rust's pattern matching is, or how to think of it in terms of a router. From my example above, check out https://github.com/dakom/dominator-workers-fluent-auth/blob/822b5bbfb188141e3164a3321779392dc088b1b5/shared/src/backend/route.rs#L39 https://github.com/dakom/dominator-workers-fluent-auth/blob/... and follow it through to https://github.com/dakom/dominator-workers-fluent-auth/blob/822b5bbfb188141e3164a3321779392dc088b1b5/shared/src/backend/route.rs#L98 https://github.com/dakom/dominator-workers-fluent-auth/blob/... Do you see that you have static and dynamic parts matching, multiple variable capture, etc.? I'm not talking from a theoretical perspective. I'm showing you an actual example of a fully baked auth system that does everything on the wishlist (and more) and has no need at all for a router because Rust is itself powerful enough to do all that out of the box
- wtetzner 2y ago> and the most likely thing is that you will neither reinvent it nor pick the best library that an opinionated framework with hundreds of eyeballs has. Having used Spring has convinced me that framework popularity has no correlation with quality.