Version: 1.7.0

Options

This chapter describes all available options in the @mocks-server/main package distribution, which includes an NPM binary file and plugins for administrating the server using a REST API and an interactive CLI:

Main options#

  • path: Path as <String> Path to the folder containing behaviors and fixtures to be used by the server. By default is /mocks
  • port: <Number> Port number for the Mocks Server to be listening. Default is 3100.
  • host: <String> Host for the server. Default is "0.0.0.0" (Listen to any local host).
  • log: <String> Logs level. Can be one of "silly", "debug", "verbose", "info", "warn", "error".
  • watch: <String> Watch behaviors folder and restart server on changes. Default is true. Use false to disable it.
  • behavior: <String> Default selected behavior when server is started.
  • delay: <Number> Responses delay time in milliseconds.

Plugins extra options#

  • cli: <String> Start interactive CLI. Default is true. Use false to disable it.
  • adminApiPath: <String> Path for the administration api. Default is "/admin". You should change it only in case there is any conflict with the api you are mocking.
  • adminApiDeprecatedPaths - <Boolean> Disables deprecated "/mocks" api path, which is still enabled by default. Used as command line argument, you can disable it using --no-adminApiDeprecatedPaths (Read the command-line-arguments chapter for further info)

These extra options are added by the @mocks-server/plugin-admin-api and the @mocks-server/plugin-inquirer-cli plugins, which are included in the @mocks-server/main package distribution.

Each plugin can add his own options when it is registered in the mocks-server. If you are starting the server programmatically using the @mocks-server/core without adding plugins, only "Main options" will be available.

For another plugins options, please refer to their own documentation.

To know how to add your own options when developing a plugin, please refer to the "programmatic usage" and "developing plugins" sections.