4 ms·
> ORM integration I don't trust a web framework that's opinionated about how I use my database. It's very hard to get a web framework right, and it's very har
by gwbas1c 2y ago
> ORM integration
I don't trust a web framework that's opinionated about how I use my database.
It's very hard to get a web framework right, and it's very hard to get an ORM right. Getting both right is nearly impossible. In a situation like this, try to be the best web framework you can be, and then gravitate towards whatever ORM(s) becomes popular.
Take a look at Express for Node.js. It's my favorite web framework because it can both do a lot, and it's very transparent. It's also not opinionated about things like the ORM.
> web framework for lazy developers
Rust is not a language for lazy developers. (Lazy developers won't fight with the borrow checker.) Instead, think more critically about why a Rust developer would need a web framework; and what they need out of it.
- WhyNotHugo 2y ago> Lazy developers won't fight with the borrow checker Once you get the hang of it, it's not a big effort any more. And the really lazy option is to just use an Arc.
- deleted 2y ago[deleted]
- pornel 2y agoRust already has several server frameworks that are relatively low-level network plumbing, and leave figuring out everything else to the user. If that's what you like, you can pick and choose from all the existing tools. The Rust's ecosystem is now missing its Rails or Django. This is an attempt to make something for those "lazy" devs who don't want to write their own cookie parsing middleware, and figure out how to get a database connection pool working with a request router.
- echelon 2y ago> Rust already has several server frameworks The incredible proliferation of Rust web frameworks should be an almost blinding beacon advertising how well-suited Rust is for web backend development. The biggest takeaway that anyone new to Rust or new to Rust-on-backend should have: Rust absolutely rocks for backend development. It's getting a tremendous amount of attention, people are trying a lot of things, and it's crystalizing as a major backend powerhouse. You can be just as performant in Rust as you can in Go, or frankly, Python, and the result is super typesafe, super ergonomic, and blindingly fast. Google recently published a paper that said as much. Rust already has several Python Flask equivalents (Actix/Axum), and it's waiting on its Rails/Django framework. For anyone scared of Rust or the borrow checker: due to the nature of HTTP services and request flow logic, you almost never bump into it when writing backend Rust. But if you ever need to write anything with multiple hand-rolled threads or worker pools, you can. Rust opens up a lot of interesting possibilities, such as rich in-memory databases. But you certainly don't have to use these powers either if you don't need them.
- dlisboa 2y ago> For anyone scared of Rust or the borrow checker: due to the nature of HTTP services and request flow logic, you almost never bump into it when writing backend Rust. I’d say for anyone worrying about it just use ‘clone()’ everywhere you can. If you’re coming from any interpreted language the performance and efficiency will just be so much better that it doesn’t matter.
- echelon 2y agoThat's an excellent way to get your footing. And you can come back in a month and fix it all easily.
- johnisgood 2y agoclone(); )?; all that stuff is just meh.
- johnisgood 2y agoI mean, who thinks using .clone() everywhere is such a good idea?
- echelon 2y agoIt's a suggestion for beginners writing their first Rust program. You wouldn't do this once you feel comfortable with the language.
- johnisgood 2y agoThey might end up with a bad habit, however.
- dlisboa 2y agoThere’s https://loco.rs/ https://loco.rs/ if you like that sort of Rails experience. Personally I’ve grown more fond of having little cruft in my apps, being “lazy” about what goes into the code isn’t right to me and many of these frameworks don’t really care about that. To me most of the value in these opinionated frameworks is in the scaffolding anyway, not the opinions.
- meltyness 2y agoIterators, type safety, built-in CI & CD & Linting, and the borrow checker are exactly for lazy developers in my opinion. Who wants to fight with C?Make Bazel Ninja?
- deleted 2y ago[deleted]
- eYrKEC2 2y agoOpinionated frameworks are very useful. They create well-worn paths that others have tried before. Every python flask environment I've ever seen has been a bespoke configuration with some selection of the massive combinatoric space that flask presents to folks. Contrast that with python Django or Ruby on Rails where opinions abound, but you can escape the well worn path if you _need_ to.
- gjsman-1000 2y agoIn my experience, most people who say “we don’t need no stinkin’ framework” end up basically inventing their own framework. Most of the time, it’s also just flat out worse. As such, my initial gut reaction is to quell the NIH syndrome.
- a-priori 2y agoHonestly as someone who has been building Rails applications for over 15 years now, I find far too many people think they are special and need to stray from the defaults.
- eYrKEC2 2y agoAbsolutely. That inclination exists everywhere. Imagine if your framework said,"let a thousand flowers bloom."
- echelon 2y ago> Rust is not a language for lazy developers. I am one, and Rust absolutely can be. > Lazy developers won't fight with the borrow checker. You don't fight the borrow checker when writing web code. The request flow is well suited for rarely, if ever, testing the borrow checker. > Instead, think more critically about why a Rust developer would need a web framework The same reason anyone would need a web framework. Anything ranging from bullshit hack to high SLA service. I'm finding Rust to be a drop-in Go and Python replacement for HTTP. It's really good at this use case, and it's certainly something you can be very lazy about with modern Rust web frameworks.
- maximilianburke 2y agoAs someone who has written a fair bit of web service code in Rust over the last 5 years or so, this is all correct.
- Thaxll 2y agoIt's absolutely not true, the moment you're out of http hello word, and you have more serious logic about data that you need to manipulate / modify you will fight the borrow checker, that's why a lot of people do a lot of rc / arc refcell. And then the async implementation.
- drogus 2y agoHave you ever written a web app in Rust? Most of the code is in a form of handlers that receive data, process the data and give some data back. There is rarely need to think about lifetimes or borrowing in these scenarios.
- steveklabnik 2y agoI’m writing a web app at work and I have one Arc and no Rc or RefCell.
- jfuawdfas 2y agoGot zero because I cheated with Box::leak
- evantbyrne 2y agoBackend development is all about data storage and retrieval. It's no coincidence that the most celebrated backend frameworks of all time developed best-in-class ORMs for their respective languages. Being able to define a single structure that defines how data moves all the way through the stack is incredibly powerful and opens up development optimizations that simply don't happen when mixing boutique libraries.
- eklavya 2y agoIt's probably not for you, it is absolutely for me. I am looking for a micronaut for Rust. There are many options to build your own thing on hyper | axum | tonic | tower if you want.