Version: 1.8.0



This chapter describes all available configuration properties and options. There are multiple methods for defining configuration and options.

When same option is defined using multiple methods, the priority is (from lower to higher):

Main options#

This options can be defined using command line arguments and can be changed while the server is running using the settings methods.

  • 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 "" (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.

Low level configuration#

This options can't be modified while the server is running, and can be defined only using the configuration file or programmatically (if you are using directly the @mocks-server/core instead of the main distribution).

  • plugins: <Array of Plugins> Array of Plugins, defined as described in the plugins chapter.
  • addPlugins: <Array of Plugins> Array of Plugins to be added. This option does not overwrite previously defined plugins.
  • configFile: <String> Custom path for configuration file. If relative, will be resolved from current working directory. Default is mocks-server.config.js
  • onlyProgrammaticOptions: <Boolean> If true, disables both command line arguments and configuration file.
  • disableCommandLineArguments: <Boolean> If true, command line arguments defining options will be ignored.
  • disableConfigFile: <Boolean> If true, configuration file will be ignored.

Plugins extra options#

Each plugin can add his own options when it is registered in the mocks-server. This options can also be defined using command line arguments and changed while the server is running.

  • 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.

If you are starting the server programmatically using the @mocks-server/core without adding any plugin, 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.