feat(api): add permissive CORS layer

Browser-based frontends need CORS to call the API. Apply
tower_http::cors::CorsLayer::permissive() at the router level so
the frontend (and other origins during development) can reach the
scan endpoint.
This commit is contained in:
LORDBABUINO
2026-05-11 20:18:31 -03:00
parent 3ab2fb3c9c
commit ca827db53e
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -19,6 +19,7 @@ stealth-bitcoincore = { path = "../bitcoincore" }
stealth-engine = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tower-http = { version = "0.6.6", features = ["cors"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
+2
View File
@@ -6,6 +6,7 @@ use std::sync::Arc;
use axum::Router;
use stealth_engine::gateway::BlockchainGateway;
use tower_http::cors::CorsLayer;
/// Shared application state: an optional blockchain gateway.
pub type GatewayState = Option<Arc<dyn BlockchainGateway + Send + Sync>>;
@@ -19,5 +20,6 @@ pub fn app() -> Router {
pub fn app_with_gateway(gateway: GatewayState) -> Router {
Router::new()
.nest("/api/wallet", routes::wallet::router())
.layer(CorsLayer::permissive())
.with_state(gateway)
}