apimock 3.2.1

API mock Server generating HTTP/JSON responses
Documentation

apimock-rs

crates.io Documentation Dependency Status Releases Workflow License

Summary

HTTP server generating REST/JSON responses. Aims to be mocking helper to develop microservices and APIs. Written in Rust and based on hyper.

Running apimock or apimock -c apimock.toml starts the server. Built as small single native binary. Supports cross-platform.

Screenshots

Server started to listen:

server starts

curl test result:

server responds

Middleware is available as rhai script:

server responds

Reference

Usage

Executable

Assets in Releases offer executables for multiple platforms.

./apimock

At startup, --init option is available to gerenate app configuration and customization files:

./apimock --init

Customization

  • Able to customize by modifying config file (./apimock.toml by default) and restarting app.
  • Dynamic routing directory is also available (./apimock-dyn-data/ by default) even without config file. App returns response by associating request URL path with relative file path under it.
  • When app runs without both ./apimock.toml and ./apimock-dyn-data/ directory, always option is automatically activated to return fixed response.

cargo install

cargo install apimock
# after installed:
apimock

Acknowledgements

Depends on:

tokio / hyper / toml / serde / serde_json / json5 / console / rhai. In addition, mdbook (as to workflows)