|
|
|
|
@ -56,7 +56,6 @@ pub struct AppState {
|
|
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
|
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
|
// logger::init_log()?;
|
|
|
|
|
tracing_subscriber::registry()
|
|
|
|
|
.with(
|
|
|
|
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
|
|
|
@ -129,15 +128,9 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.layer(
|
|
|
|
|
// see https://docs.rs/tower-http/latest/tower_http/cors/index.html
|
|
|
|
|
// for more details
|
|
|
|
|
//
|
|
|
|
|
// pay attention that for some request types like posting content-type: application/json
|
|
|
|
|
// it is required to add ".allow_headers([http::header::CONTENT_TYPE])"
|
|
|
|
|
// or see this issue https://github.com/tokio-rs/axum/issues/849
|
|
|
|
|
CorsLayer::new()
|
|
|
|
|
.allow_origin("*".parse::<HeaderValue>().unwrap())
|
|
|
|
|
.allow_methods([Method::GET]),
|
|
|
|
|
.allow_methods([Method::GET])
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Run tasks
|
|
|
|
|
|