Skip to content

Commit 613b1eb

Browse files
authored
Replace example with link to docs
context: #1071
1 parent ee957b6 commit 613b1eb

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

crates/cors/src/lib.rs

+2-25
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,8 @@
22
//!
33
//! [CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
44
//!
5-
//! # Example
6-
//!
7-
//! ```
8-
//! use salvo_core::http::Method;
9-
//! use salvo_core::prelude::*;
10-
//! use salvo_cors::Cors;
11-
//!
12-
//! let cors_handler = Cors::new()
13-
//! .allow_origin("https://salvo.rs")
14-
//! .allow_methods(vec![Method::GET, Method::POST, Method::DELETE]).into_handler();
15-
//!
16-
//! let router = Router::new().hoop(cors_handler).post(upload_file).options(upload_file);
17-
//! #[handler]
18-
//! async fn upload_file(res: &mut Response) {
19-
//! }
20-
//!
21-
//! ```
22-
//! If you want to allow any origin:
23-
//! ```
24-
//! use salvo_core::prelude::*;
25-
//! use salvo_cors::{self as cors, Cors};
26-
//! let cors_handler = Cors::new().allow_origin(cors::Any).into_handler();
27-
//! ```
28-
//!
29-
//! Read more: <https://salvo.rs>
5+
//! # Docs
6+
//! Find the docs here: <https://salvo.rs/book/features/cors.html>
307
#![doc(html_favicon_url = "https://salvo.rs/favicon-32x32.png")]
318
#![doc(html_logo_url = "https://salvo.rs/images/logo.svg")]
329
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)