diff --git a/server/src/main.rs b/server/src/main.rs index 76a4d89..8407c56 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -56,7 +56,6 @@ pub struct AppState { #[tokio::main] pub async fn main() -> Result<(), Box> { - // logger::init_log()?; tracing_subscriber::registry() .with( tracing_subscriber::EnvFilter::try_from_default_env() @@ -129,15 +128,9 @@ pub async fn main() -> Result<(), Box> { ), ) .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::().unwrap()) - .allow_methods([Method::GET]), + .allow_methods([Method::GET]) ); // Run tasks diff --git a/server/src/route/company.rs b/server/src/route/company.rs index a165d16..feb2cf1 100644 --- a/server/src/route/company.rs +++ b/server/src/route/company.rs @@ -33,7 +33,7 @@ pub async fn get_by_name( let conn = state.db; let res = company::Entity::find() .filter(company::Column::Name.contains(&name)) - .limit(limit.unwrap_or(10)) + .limit(limit.unwrap_or(10).min(10)) .all(&conn) .await?;