apimock 4.7.0

HTTP(S) mock server. Drop JSON files into a folder and your API immediately exists.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! App entry point for the `apimock` executable.
//!
//! # Why `anyhow::Result` here
//!
//! Internal code uses the typed `AppError` from `core::error`. At the
//! process boundary we only care about printing a single human-readable
//! line and exiting non-zero, so we flatten into `anyhow::Result` — this
//! gives a free `Display` via `?` in `main` without any ceremony.
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let Some(env_args) = apimock::core::args::EnvArgs::default()? else {
        // --init was supplied (or similar): work already done, nothing to run
        return Ok(());
    };
    let app = apimock::new(&env_args).await?;
    app.server.start().await;
    Ok(())
}