4 ms·
I saw a YT video about how safe Rust is. I want to give it a try but I do mainly web applications, where I use Spring Boot and front-end frameworks. From what
by jmartrican 4y ago
I saw a YT video about how safe Rust is. I want to give it a try but I do mainly web applications, where I use Spring Boot and front-end frameworks. From what I have read Rust is better for system level or regular applications (not web apps). Can modern web applications be built efficiently with Rust? And by efficiently I mean, is the ecosystem there (libraries and tools).
I imagine the following would be needed..
1) Spring MVC like library for interfacing with HTTP requests.
2) DB ORM or ORM like. DB libraries for any possible DB.
3) centralized logging. e,g, Logback that forwards all logs to ELK.
4) Dependency injection.
5) Versatile configuration system. Similar to Spring configurations.
6) AWS SDK.
7) Commons like libs like Guice or Apache Commons.
stuff like that.
- insanitybit 4y agoWe use Actix for HTTP. Works fine. I don't use ORMs, I prefer sqlx, which gives me compile time checking of queries while still just writing plain old sql. I log via the tracing library to stdout, I let other services handle what's done at that point. I don't use DI frameworks, nor do I believe that they are good, I use dependency injection via construction, which works great. I don't do any fancy configuration. I use `clap` to take in values and ideally I'll never do any config anywhere else in my program. The AWS SDK from rusoto works well enough. AWS has a beta SDK out for Rust as well, seems good. I haven't found any need for libraries like Guice, there's metrics, collections, and everything else I've needed in crates.io.
- jmartrican 4y agoThanks for your reply. Can you disclose what web application this is you work on?
- insanitybit 4y agohttps://graplsecurity.com/ https://graplsecurity.com/ That's my company. The blog is hosted elsewhere. Our frontend is hosted via a rust service, which talks to other rust services via grpc.
- UltraViolence 4y agoRocket is another nice Rust web framework. You can choose your own template engine instead of having to use one that's provided (like in ASP.NET MVC). There are a multitude of template engines available in Rust.
- Sohcahtoa82 4y ago> 4) Dependency injection. Can you explain why DI needs an entire framework/libary? When I was taught DI in school, I was given the impression that DI was a $1000 term for a $5 concept in that without DI, you write code like this: class Foo(object): def __init__(self): self.bar = GetBar() whereas with DI, you write this: class Foo(object): def __init__(self, bar): self.bar = bar Obviously, I'm grossly misunderstanding what DI is, because if that's really all it was, you wouldn't need a DI framework. I just haven't had to write code using any sort of DI more complicated than that.
- xboxnolifes 4y agoWhat you say is dependency injection, but what people usually mean when they say a "dependency injection framework" is the bits of managing the creation of dependencies and getting them into the class's scope without having to add it as a parameter to every upper scope class's argument list.
- Sohcahtoa82 4y agoAh... Do you know any good references for describing DI frameworks more? Because right now, my cynical take based on your description is that it's a TON of over-engineering and an absurd amount of complexity being added just to avoid a couple extra lines of code.