-
Hello In actix-web it was possible using the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It would be better to use external tooling for runtime profiling. |
Beta Was this translation helpful? Give feedback.
-
@khvzak you can implement middleware service regarding actix-web and errors, that shouldn’t be too big of surprise. it’s http1 dispatcher is mostly one that i wrote several years ago and it was shit, nothing changed recently. i rewrote dispatcher in ntex 3 times until settle with current design. |
Beta Was this translation helpful? Give feedback.
-
Thanks Nikolay! I'll try to add a middleware to wrap http service in. The ntex design (incl. middlewares, http body, etc) looks better than in actix (and more easy to use). I'm trying to migrate from actix (as an experiment) in my company's project and see how it will go. UPD: let service =
HttpService::build()
.finish(fn_service(|_req| async move {
Ok::<_, std::io::Error>(Response::Ok().body("Hello world!"))
}));
apply_fn_factory(service, |io: Io, handler| {
let peer_addr = io.query::<PeerAddr>().get().unwrap();
println!("new connection from {peer_addr:?}");
handler.call(io)
}) |
Beta Was this translation helpful? Give feedback.
@khvzak you can implement middleware service
ServiceFactory<Io<F>>
and wrap http service in it, then you’ll be able to access Io at the begging and after http service completes handlingregarding actix-web and errors, that shouldn’t be too big of surprise. it’s http1 dispatcher is mostly one that i wrote several years ago and it was shit, nothing changed recently. i rewrote dispatcher in ntex 3 times until settle with current design.