allow cors
This commit is contained in:
parent
18b827690f
commit
50e9d0d1e0
2 changed files with 4 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ eyre.workspace = true
|
||||||
|
|
||||||
axum = { optional = true, version = "0.8.4", default-features = false, features = ["http2", "ws", "macros"] }
|
axum = { optional = true, version = "0.8.4", default-features = false, features = ["http2", "ws", "macros"] }
|
||||||
http-body-util = { version = "0.1.3", optional = true }
|
http-body-util = { version = "0.1.3", optional = true }
|
||||||
tower-http = { optional = true, version = "0.6.6", default-features = false, features = ["limit"] }
|
tower-http = { optional = true, version = "0.6.6", default-features = false, features = ["cors"] }
|
||||||
serde_urlencoded = { version = "0.7.1", optional = true }
|
serde_urlencoded = { version = "0.7.1", optional = true }
|
||||||
|
|
||||||
tokio = { workspace = true, optional = true }
|
tokio = { workspace = true, optional = true }
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,13 @@ pub async fn serve(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_router<T: Types>(service: T::Service) -> axum::Router {
|
pub fn make_router<T: Types>(service: T::Service) -> axum::Router {
|
||||||
|
use tower_http::cors;
|
||||||
|
|
||||||
let scope = handler::RouterScope::root(State::<T> { service });
|
let scope = handler::RouterScope::root(State::<T> { service });
|
||||||
routes::make(scope)
|
routes::make(scope)
|
||||||
.into_axum()
|
.into_axum()
|
||||||
.layer(fastrace_axum::FastraceLayer)
|
.layer(fastrace_axum::FastraceLayer)
|
||||||
|
.layer(cors::CorsLayer::permissive())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[perfect_derive(Clone)]
|
#[perfect_derive(Clone)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue