From 613b1eb34d4c32c26c2a24bf72bd8bbd43b3b9d7 Mon Sep 17 00:00:00 2001 From: Manuel <2084639+tennox@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:48:46 +0100 Subject: [PATCH] Replace example with link to docs context: https://github.com/salvo-rs/salvo/issues/1071 --- crates/cors/src/lib.rs | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/crates/cors/src/lib.rs b/crates/cors/src/lib.rs index c7542c02a..152c69846 100644 --- a/crates/cors/src/lib.rs +++ b/crates/cors/src/lib.rs @@ -2,31 +2,8 @@ //! //! [CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS //! -//! # Example -//! -//! ``` -//! use salvo_core::http::Method; -//! use salvo_core::prelude::*; -//! use salvo_cors::Cors; -//! -//! let cors_handler = Cors::new() -//! .allow_origin("https://salvo.rs") -//! .allow_methods(vec![Method::GET, Method::POST, Method::DELETE]).into_handler(); -//! -//! let router = Router::new().hoop(cors_handler).post(upload_file).options(upload_file); -//! #[handler] -//! async fn upload_file(res: &mut Response) { -//! } -//! -//! ``` -//! If you want to allow any origin: -//! ``` -//! use salvo_core::prelude::*; -//! use salvo_cors::{self as cors, Cors}; -//! let cors_handler = Cors::new().allow_origin(cors::Any).into_handler(); -//! ``` -//! -//! Read more: +//! # Docs +//! Find the docs here: #![doc(html_favicon_url = "https://salvo.rs/favicon-32x32.png")] #![doc(html_logo_url = "https://salvo.rs/images/logo.svg")] #![cfg_attr(docsrs, feature(doc_cfg))]