File tree 1 file changed +2
-25
lines changed
1 file changed +2
-25
lines changed Original file line number Diff line number Diff line change 2
2
//!
3
3
//! [CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
4
4
//!
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>
30
7
#![ doc( html_favicon_url = "https://salvo.rs/favicon-32x32.png" ) ]
31
8
#![ doc( html_logo_url = "https://salvo.rs/images/logo.svg" ) ]
32
9
#![ cfg_attr( docsrs, feature( doc_cfg) ) ]
You can’t perform that action at this time.
0 commit comments