MCPcopy Index your code
hub / github.com/dreamsofcode-io/chatly / main

Function main

src/main.rs:62–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61#[tokio::main]
62async fn main() -> Result<(), Box<dyn std::error::Error>> {
63 tracing::subscriber::set_global_default(FmtSubscriber::default())?;
64
65 let messages = state::MessageStore::default();
66
67 let (layer, io) = SocketIo::builder().with_state(messages).build_layer();
68
69 io.ns("/", on_connect);
70
71 let app = axum::Router::new()
72 .route("/", get(|| async { "Hello, World!" }))
73 .route("/hello", get(handler))
74 .with_state(io)
75 .layer(
76 ServiceBuilder::new()
77 .layer(CorsLayer::permissive())
78 .layer(layer),
79 );
80
81 info!("Starting server");
82
83 axum::Server::bind(&"127.0.0.1:3000".parse().unwrap())
84 .serve(app.into_make_service())
85 .await?;
86
87 Ok(())
88}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected