I am currently developing a new IoT-project and we decided to program it in rust since part of the embedded architecture can run the same code as the server side.
mainly the COAP utilizing the 6lowpan for meshing and a classic NFC communication.
I have to design the SaaS parts since I am specialized in HA distributed system architecture.
I am experimenting with:
rocket.rs which is a nice framework but it's mainly synchronous. still it has a lot of thought put into it, from an app developer perspective.
gotham.rs which is built on top of tokio with hyper - this seams promising since if everything goes well I will need futures anyway and tokio is the defacto standard for complex networking. But it is more flexible which means it's less beginner friendly to use.
I know there are these other frameworks as well arewewebyet.org/topics/frameworks
To make anything but a hip-shot I want some feedback from people who actually built something with those web-frameworks. Even better something on a larger scale.
So what is your current choice for a rust web-framework and why?
stuff ;)
Never built anything on a large scale, yet, however I checked out Rocket, Gotham and Actix-Web, and of the three, I personally like the last one the most, because it is very maintainable, scalable and can handle requests in parallel easily. It supports many modern things out of the box, like HTTP2, WebSockets, Middleware, etc. It's also built on top of Tokio and once you wrap your head around the actor framework, it's stupidly easy and maintainable (see for example my simple WS server for my Hashnode TM script).
Example:
extern crate actix_web; use actix_web::{server, App, HttpRequest, Responder}; fn greet(req: &HttpRequest) -> impl Responder { let to = req.match_info().get("name").unwrap_or("World"); format!("Hello {}!", to) } fn main() { server::new(|| { App::new() .resource("/", |r| r.f(greet)) .resource("/{name}", |r| r.f(greet)) }) .bind("127.0.0.1:8000") .expect("Can not bind to port 8000") .run(); }One of the things I am constantly missing, though, is a way to replace certificates at runtime, so we can use the ACME protocol for Let's Encrypt (or an internal ACME provider). So if anyone encounters a Rust web server framework which supports ACME, cc me :D