Skip to content

Commit

Permalink
Add instructions about starting a stand-alone server to the Rust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lipanski committed Feb 21, 2024
1 parent a982823 commit 5aac55a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@
//! }
//! ```
//!
//! Start a **stand-alone server** on a dedicated port:
//!
//! ```
//! fn main() {
//! let opts = mockito::ServerOpts {
//! host: "0.0.0.0",
//! port: 1234,
//! ..Default::default()
//! };
//! let mut server = mockito::Server::new_with_opts(opts);
//!
//! let _m = server.mock("GET", "/").with_body("hello world").create();
//!
//! // loop {}
//! }
//! ```
//!
//! # Lifetime
//!
//! A mock is available only throughout the lifetime of the server. Once the server goes
Expand Down

0 comments on commit 5aac55a

Please sign in to comment.