Version: 1.9.0
Adding plugins
#
PluginsPlugins are a way of extending the functionality of Mocks Server.
Some things that can be made with a plugin are:
- Load "behaviors" or "fixtures".
- Listen to Mocks Server events and act in consequence.
- Add custom express routers to the server.
- Add new options, accessible even through command line arguments.
- Change settings while the server is running.
- Add new formats of defining "fixtures". (Using "custom fixtures handlers")
#
Find pluginsUse the "mocks-server-plugin" tag to search Mocks Server plugins in NPM.
#
Add plugins#
Configuration fileUse the configuration file for adding plugins:
Note the usage of the
addPlugins
property, not theplugins
one. This is because the main distribution of the Mocks Server (@mocks-server/main) already includes some plugins to improve the user experience. If you useplugins
instead ofaddPlugins
, you will remove those ones added by default.
#
ProgrammaticallyIf you are using the @mocks-server/core package to initialize the mocks-server programmatically, you can define the plugins to use as described in the programmatic usage chapter.