apimock/lib.rs
1//! A developer-friendly, robust and functional HTTP mock server
2//! built in Rust, based on [hyper](https://hyper.rs/) and [tokio](https://tokio.rs/).
3
4pub mod core;
5use core::app::App;
6use core::args::EnvArgs;
7
8/// return hyper http server
9#[cfg(not(feature = "spawn"))]
10pub async fn run(env_args: &EnvArgs) -> App {
11 App::new(env_args, None, true).await
12}
13
14#[cfg(feature = "spawn")]
15use tokio::sync::mpsc::Sender;
16
17/// accept sender to main proc set to logger and
18/// return hyper http server
19/// `includes_ansi_codes`: if true, log includes ansi escape codes for console text color
20#[cfg(feature = "spawn")]
21pub async fn run(env_args: &EnvArgs, spawn_tx: Sender<String>, includes_ansi_codes: bool) -> App {
22 App::new(env_args, Some(spawn_tx), includes_ansi_codes).await
23}