mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 16:52:58 +01:00
chore(rt): remove hyper example
This commit is contained in:
parent
2d9b147cc3
commit
2a4df30c63
@ -37,4 +37,3 @@ tokio-uring = { version = "0.4", optional = true }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1.23.1", features = ["full"] }
|
tokio = { version = "1.23.1", features = ["full"] }
|
||||||
hyper = { version = "0.14.10", default-features = false, features = ["server", "tcp", "http1"] }
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
use std::{convert::Infallible, net::SocketAddr};
|
|
||||||
|
|
||||||
use hyper::{
|
|
||||||
service::{make_service_fn, service_fn},
|
|
||||||
Body, Request, Response, Server,
|
|
||||||
};
|
|
||||||
|
|
||||||
async fn handle(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
|
||||||
Ok(Response::new(Body::from("Hello World")))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
actix_rt::System::with_tokio_rt(|| {
|
|
||||||
tokio::runtime::Builder::new_multi_thread()
|
|
||||||
.enable_all()
|
|
||||||
.build()
|
|
||||||
.unwrap()
|
|
||||||
})
|
|
||||||
.block_on(async {
|
|
||||||
let make_service =
|
|
||||||
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
|
||||||
|
|
||||||
let server = Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service);
|
|
||||||
|
|
||||||
if let Err(err) = server.await {
|
|
||||||
eprintln!("server error: {}", err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user