Live data from Hacker News

Rust needs a web framework

ntietz.com

61–70 of 395 posts

Re: Rust needs a web framework

#61
post #10

> I like to make silly things, and I also like to put in minimal effort for those silly things. I also like to make things in Rust… I think this part is perhaps the silliest part of a very silly article. If you really like to put in a minimal effort then why on earth would you use Rust? If you want efficiency, memory management and a compiled modern language just use Go. Then you won’t even need anything but the stan…

I don't as a rule web dev, so when I do I fall into the same category as the author: lowest effort to get something mostly right.

An explanation for "why bother try to have a low effort web server in Rust?" that I haven't seen mentioned: Once you're past the introductory phase of being familiar with Rust, if you don't need to pedantically handle every error case, it can be _very_ simple.

A low effort "doesn't have to be very flexible" web server would be terrific & easy to use in Rust.

Having said that, I'm not aware of the actual offerings available. Maybe there is one, other posts have suggestions.

Re: Rust needs a web framework

#62
Take F# for a spin. It offers nearly all of the type system tomfoolery one craves and all the tooling and nice-to-haves one wants. The big drag is that the async story and memory management aren't as big as a time vampire as Rust, so you do run the risk of actually solving business needs. I am sure some part of dealing with Microsoft can fill that void, though.

Re: Rust needs a web framework

#63
post #10

> I like to make silly things, and I also like to put in minimal effort for those silly things. I also like to make things in Rust… I think this part is perhaps the silliest part of a very silly article. If you really like to put in a minimal effort then why on earth would you use Rust? If you want efficiency, memory management and a compiled modern language just use Go. Then you won’t even need anything but the stan…

Rust has benefits besides just memory safety and being efficient, it has great language design and a great toolchain. I chose (learning) rust over golang for quite simple projects with no performance requirements, out of sheer frustration with the toolchain/design of go, golang came off to me as "let's try to be special and make bizarre design decisions" which made it confusing to learn, not only that but I very quickly ran into pain points, whereas rust felt like everything just took the most logical straightforward path, and everything "just worked". It, to me, genuinely feels simpler, because things were what I expected. Kind of like apple simplifying their mouse to have no buttons and thinking it's very simple and easy, but then its just more complicated because it's so unusual, whereas everyone knows exactly how a normal mouse works. Just my view. I use typescript and needed a language to make a couple simple programs that could compile to a single executable, I'd love another option but don't want to use one that's not matured enough.

Re: Rust needs a web framework

#64
So strange reading all the comments here saying that Rust is not a language for "lazy developers".

I'm an incredibly lazy developer and Rust only makes me lazier. I can pretty much turn off the part of my brain that deals with "programming language" stuff and put all that energy towards the part of my brain that deals with "building stuff" whenever I write code in Rust, because I have a high level of confidence that the language itself isn't trying to make me shoot myself in the foot at every turn.

Rust is the only language where I can open something like Notepad without an LSP or highlighting, write code for an hour without testing or compiling, and then run clippy a few times to see and make the suggested fixes. It doesn't get any lazier than that.

On the web framework topic: Rocket is the greatest "lazy developer" web framework I've ever used.

Re: Rust needs a web framework

#65
post #36

Rust has some great and useful web frameworks that are a joy to use, once you understand what is going on. For example, in Axum, they use traits cleverly to allow you to use dependency injection the same way that fastapi uses it. But at least when I started using it, that wasn’t an insight made bluntly clear with tutorials as good as tiangolo’s. Instead, I had to piece it together via examples in the axum repo as wel…

Curious which YouTube video you watched that helped learn Axum.

https://youtu.be/Wnb_n5YktO8?si=lCGrH36DvXATdyEs

Re: Rust needs a web framework

#66
post #50

Servo is in Rust. I want to make an app in Rust that hosts Servo in it with my business logic in maybe SciterJS - like electron but hopefully lighter? Something, just a business software guy who wants something with more control than an webapp and not so heavy like electron.

Tauri?

https://tauri.app

Re: Rust needs a web framework

#67

For new web applications, why recommend alternatives to Next.js? How do you convince someone to use an alternative? The knowledge needed to understand why will help you get close enough in Next.js anyway.

The npm dependency ecosystem is extremely tangled. I work with node frequently, but there's plenty of opportunities for bad actors to introduce abuse and I'm wondering when the other shoe will drop.

[deleted]

Re: Rust needs a web framework

#68
Python has Django, C# has ASP .NET Core, Ruby has Rails, and so on... If you want to really make Rust take off with web development, build up a full-feature solution.

Rocket is maybe the closest? But it's not as batteries included as any of the frameworks I've mentioned.

Re: Rust needs a web framework

#69

Earlier quoted context omitted.

This is definetly something the article should have drilled down on. Why Rust? I'm sure everyone's tired of hearing why rust is an excellent alternative to c/c++ for new projects, but as an alternative against Python it gets muddier. Rust has a clear advantage in performance and memory footprint and a much better multithreading story, but those are things that aren't high priorities for 95% of web development. That b…

The answer for why folks are so inclined towards doing high-level tasks in Rust... is the type system. Its sensibilities are in a sweet spot that makes it very easy to pull off huge refactors. It was also a lot of people's first introduction to algebraic data types being used in nearly all error handling (its usage of `Result where E implements Error` and lack of nulls or exceptions). It makes a lot of progress towar…

>Result where E implements Error` and lack of nulls or exceptions

This all goes out the window when people throw “unwrap” all over the place because “this should always succeed”.

Re: Rust needs a web framework

#70
post #26

There is one: Poem[1] The author mentions flask but looking at the "What we need section", I don't think flask covers those. I hate Djago with a passion but if those are the requirements, I think Django is the one that closely resembles what the author is describing. So Poem is not a good candidate either in that regard. Poem is all in all, something that closely resembles FastAPI, which is actually a complement. I'v…

Not just Django, probably Rails, ASP .NET Core, and many other full-feature, batteries included web frameworks. Emphasis on framework.
Post reply on HN