MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / run_server_with_state

Function run_server_with_state

crates/opencode-server/src/server.rs:498–514  ·  view source on GitHub ↗
(
    addr: SocketAddr,
    state: Arc<ServerState>,
)

Source from the content-addressed store, hash-verified

496}
497
498pub async fn run_server_with_state(
499 addr: SocketAddr,
500 state: Arc<ServerState>,
501) -> anyhow::Result<()> {
502 let app = routes::router()
503 .layer(cors_layer())
504 .layer(TraceLayer::new_for_http())
505 .with_state(state);
506
507 let listener = tokio::net::TcpListener::bind(addr).await?;
508
509 tracing::info!("Server listening on {}", addr);
510
511 axum::serve(listener, app).await?;
512
513 Ok(())
514}
515
516#[cfg(test)]
517mod tests {

Callers

nothing calls this directly

Calls 2

routerFunction · 0.85
cors_layerFunction · 0.85

Tested by

no test coverage detected