Skip to content

Commit

Permalink
docs: don't run top level examples + reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkov committed Dec 30, 2023
1 parent 9eb07b4 commit 048f3a0
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
//!
//! # Usage
//!
//! ```rust
//! ```no_run
//! use ntex::web;
//! use ntex_helmet::Helmet;
//!
//! #[ntex::main]
Expand Down Expand Up @@ -47,30 +48,32 @@
//!
//! It is possible to configure `Helmet` to set only the headers you want, by using the `add` method to add headers.
//!
//! ```rust
//! use ntex_helmet::{Helmet, ContentSecurityPolicy, CrossOriginOpenerPolicy};
//! ```no_run
//! use ntex::web;
//! use ntex_helmet::{ContentSecurityPolicy, CrossOriginOpenerPolicy, Helmet};
//!
//! #[ntex::main]
//! async fn main() -> std::io::Result<()> {
//! web::HttpServer::new(move || {
//! web::App::new()
//! .wrap(
//! Helmet::new().add(
//! ContentSecurityPolicy::new()
//! .child_src(vec!["'self'", "https://youtube.com"])
//! .connect_src(vec!["'self'", "https://youtube.com"])
//! .default_src(vec!["'self'", "https://youtube.com"])
//! .font_src(vec!["'self'", "https://youtube.com"]),
//! ),
//! Helmet::new()
//! .add(
//! ContentSecurityPolicy::new()
//! .child_src(vec!["'self'", "https://youtube.com"])
//! .connect_src(vec!["'self'", "https://youtube.com"])
//! .default_src(vec!["'self'", "https://youtube.com"])
//! .font_src(vec!["'self'", "https://youtube.com"]),
//! )
//! .add(CrossOriginOpenerPolicy::same_origin_allow_popups()),
//! )
//! .add(CrossOriginOpenerPolicy::same_origin_allow_popups())
//! .service(web::resource("/").to(|| async { "Hello, world!" }))
//! })
//! .bind(("127.0.0.1", 8080))?
//! .bind(("127.0.0.1", 4200))?
//! .run()
//! .await
//! }
//!
//! ```
use core::fmt::Display;

use ntex::{
Expand Down

0 comments on commit 048f3a0

Please sign in to comment.