Run multiple mock servers from one or more OpenAPI Specification.
Schemas can be provided from a remote origin (https:// or git@) or a local path.
Remote and circular references are allowed.
You can use api-mock-runner in a three different ways. All of them starts a CLI guided journey:
npx @sngular/api-mock-runner
sudo npm install --global @sngular/api-mock-runner
To use: type api-mock-runner
in the terminal.
npm i --save-dev @sngular/api-mock-runner
You could avoid CLI interaction by using api-mock-runner
with flags.
To explore manual options, use -h flag:
npx @sngular/api-mock-runner -h
Usage: api-mock-runner [options]
Options:
-o, --origin <origin> path or repo containing schemas
-s, --schema [schemaPaths...] path to schemas
-p, --port [ports...] port to serve each schema
-r, --run-config use saved config
-h, --help display help for command
The application will return the first response found in the schema by default. To use another existing response, use prefer
header with the content statusCode=XXX
in the request.
prefer: statusCode=500
Here you can find architectural decisions records
We would like to express our special thanks to open-api-mocker, which is used to set up a mock server.