Reference

CLI

Complete reference for the mocko command. For a guided tour of the same options, see Running Mocko: CLI.

Usage

mocko [options] [path to mocks folder]

The mocks folder is optional; without it, file mocks are disabled for the session. Requires Node.js 20.19 or newer, installed with npm install -g @mocko/cli.

Options

FlagDefaultDescription
-h, --helpShow usage help.
-v, --versionShow the installed version.
-w, --watchoffWatch the mocks folder and reload on file changes.
-p, --port8080Port for the mock server.
-u, --urlunsetProxy target for requests no mock matches. Unset means unmatched requests return 404.
-t, --timeout30000Max milliseconds to wait for a proxied response.
--no-uiUI onDisable the control panel.
-r, --redisunsetRedis URL enabling Redis mode, e.g. redis://localhost:6379.
-P, --ui-port6625Port for the control panel.

Examples

$mocko --watch mocks
$mocko -p 4000 -u https://demo-api.mockoapp.net --watch mocks
$mocko --no-ui -r redis://localhost:6379 mocks

Notes

  • The UI is enabled by default; the CLI generates a fresh internal secret per run to connect it to the mock server.
  • Hidden files and folders (names starting with a dot) inside the mocks folder are ignored.
  • On unsupported Node versions the CLI exits with a link to the update instructions instead of failing later at runtime.