4 ms·
> Rust web frameworks do not let you easily test your application's database access layer nor provide advanced authorization Can you expand on this comment a b
by bluejekyll 6y ago
> Rust web frameworks do not let you easily test your application's database access layer nor provide advanced authorization
Can you expand on this comment a bit? I find testing in Rust to be fantastic. Rocket makes for calling test functions simply via standard rust in tests, though you’ll need to build some test harness boot strap for your DB, but you generally end up doing that in any language for functional/end-to-end tests.
- WJW 6y ago> you’ll need to build some test harness boot strap for your DB You kinda answered your own question here. Rails and Django have built in support for end-to-end and functional tests, including database access in the same way as the normal app, all autogenerated. That is just table stakes for web frameworks these days.
- bluejekyll 6y agoI’m not super familiar with Django, but don’t you still have to run all your db upgrade scripts, etc? Does the Django framework handle that for you?
- dnautics 6y agoDjango implicitly generates migrations from your class structure. It's a choice, but it works very well up to a point that 90% of simple web apps will never get to.
- thomaslord 6y agoI think this probably covers it: > you’ll need to build some test harness boot strap for your DB From what I've seen, it's totally possible to use Rust for web development. However, there are tons of web frameworks in various languages that provide way more out of the box than you can find in Rust. These frameworks have had tons of time to mature - Ruby on Rails is 16 years old, Django is 15 years old, Laravel is 9 years old, and so on. I think (and hope) Rust will get there eventually, but I think it'll take some time. There's a lot of hype, but speaking as a web developer who's interested in Rust I think there will need to be a lot more tooling and a lot of educational content before it gains any significant market share. I got my start with C/C++ before I ever touched web stuff, but I never got too far into advanced language features. That combined with not having written a serious C program in years makes Rust something I'd really have to commit to learning, so even though I'd love to have a faster better-typed alternative to PHP I won't be writing any actual webapps in Rust in the near term. Basically, I think most of the people writing webapps in Rust will be Rust people interested in the web rather than web people interested in Rust for a while. There are of course organizations that do more complex stuff on the web and will jump on this sooner, especially places that use microservices and don't have to move their whole platform over, but many people building simpler sites with smaller teams will wait until there's a substantially larger ecosystem.
- hugodutka 6y agothomaslord and WJW did a great job saying what I would have said. Django already provides you the harness, and when you try to implement it yourself you will run into some gnarly technical problems. How do you make sure one test's database changes are not seen by a different test? Are you going to run tests sequentially and reset the DB before every single one? Or are you going to try to wrap your requests in a transaction that can be rolled back afterwards? Any approach you take, you are reinventing what Django already does.
- charrondev 6y agoAs someone that’s maintained an E2E test harness in PHP including internal dispatching, having multiple DBs active in a test suite, having multiple active sites running and communicating with each other, handling integration tests to Elastic, Sphinx, and Memcached, I really don’t think it’s such a big deal to spend a day or 2 plumbing out your test harness for a “big” app. A big app takes years of work, and along the way you be building utility functions to easily stand up test data. It’s not that hard and you don’t need it all at once.
- hugodutka 6y agoThat's an interesting take. My experience has been mainly with small to medium sized applications, and I just have not wanted to expend the resources to maintain a custom test harness.