Skip to content

Commit

Permalink
Replace example with link to docs (#1072)
Browse files Browse the repository at this point in the history
context: #1071
  • Loading branch information
tennox authored Mar 3, 2025
1 parent ee957b6 commit b59ef03
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions crates/cors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://salvo.rs>
//! # Docs
//! Find the docs here: <https://salvo.rs/book/features/cors.html>
#![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))]
Expand Down

0 comments on commit b59ef03

Please sign in to comment.