MCPcopy Create free account
hub / github.com/OpenFunction/samples / main

Function main

functions/knative/wasmedge/http-server/server/src/main.rs:37–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36#[tokio::main(flavor = "current_thread")]
37async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
38 let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
39
40 let listener = TcpListener::bind(addr).await?;
41 println!("Listening on http://{}", addr);
42 loop {
43 let (stream, _) = listener.accept().await?;
44
45 tokio::task::spawn(async move {
46 if let Err(err) = Http::new().serve_connection(stream, service_fn(echo)).await {
47 println!("Error serving connection: {:?}", err);
48 }
49 });
50 }
51}

Callers

nothing calls this directly

Calls 1

acceptMethod · 0.45

Tested by

no test coverage detected