Skip to main content
Version: 3.0.0

Programmatic usage

Core usage

The server can be instantiated and started programmatically using the @mocks-server/core package, which does not include plugins.

You can also register your own or another existing plugins, so you could even create your custom distribution with plugins of your choice.


const Core = require("@mocks-server/core");
const AdminApi = require("@mocks-server/plugin-admin-api");
const InquirerCli = require("@mocks-server/plugin-inquirer-cli");

const mocksServer = new Core({
config: {
readFile: false,
readEnvironment: false,
readArguments: false,
plugins: {
register: [AdminApi, InquirerCli]

server: {
port: 3500
mocks: {
delay: 1000
log: "debug"

Core API

new Core([config])

  • config (Object): Object containing configuration properties and options as described in the configuration chapter.

Core instance API

Please read the mocksServer API chapter to know all available methods and getters in the mocksServer instance that the Core class returns.