Options
#
MethodsThis chapter describes all available configuration properties and options. There are multiple methods for defining configuration and options.
When the same option is defined using multiple methods, the priority is (from lower to higher):
#
Main optionsThese options can be defined using command line arguments, the configuration file, and can be changed while the server is running using the settings
methods.
path
(String): Path to the folder containing mocks and routes to be used by the server. Default is/mocks
port
(Number): Port number for Mocks Server to be listening at. Default is3100
.host
(String): Host for the server. Default is0.0.0.0
(Listen to any local host).log
(String): Logs level. Can be one ofsilly
,debug
,verbose
,info
,warn
orerror
.watch
(String): Watch mocks folder and restart server on changes. Default istrue
. Usefalse
to disable it.mock
(String): Mock to use when the server is started.delay
(Number): Responses delay time in milliseconds.
#
Plugins extra optionsEach plugin can add its own options when it is installed. These options can also be defined and changed using the same methods as the main options.
cli
(String): Start interactive CLI. Default istrue
. Usefalse
to disable it.adminApiPath
(String): Path for the administration REST API. Default is/admin
. You should change it only in case there is any conflict with the api you are mocking.
note
These extra options are added by the @mocks-server/plugin-admin-api and the @mocks-server/plugin-inquirer-cli plugins, which are both included in the Mocks Server main distribution.
For another plugins options, please refer to their own documentation.
#
Low level configurationThis options can't be modified while the server is running, and can be defined only using the configuration file or programmatically.
plugins
(Array ofPlugin
): Array of Plugins, defined as described in the plugins chapter.addPlugins
(Array ofPlugin
): Array of Plugins to be added. This option does not overwrite previously defined plugins.addRoutesHandlers
(Array ofRouteHandler
): Array ofRouteHandler
to be added. This option does not overwrite previously defined plugins.configFile
(String): Custom path for the configuration file. If relative, it will be resolved from current working directory. Default ismocks.config.js
.onlyProgrammaticOptions
(Boolean): Iftrue
, it disables both command line arguments and configuration file.disableCommandLineArguments
(Boolean) Iftrue
, all command line arguments defining options will be ignored.disableConfigFile
(Boolean): Iftrue
, the configuration file will be ignored.