This is a Mock Server for development, allow to define custom endpoint and starting data. Furnished with an In-Memory storage will speed up your development flow.

Usage no npm install needed!

<script type="module">
  import easyMocker from 'https://cdn.skypack.dev/easy-mocker';



Build Status


This is a NodeJs webserver intended for development. It provides a basic and quick way to define mock response trough a collection of JSON responses and a JSON file containing endpoint definition.


Grab it form npm: npm install easy-mocker

Minimum usage: easy-mocker -c config.json -d folder/


Option Value Description
-c* path/to/config.json Path to api definition
-d* path/to/mock-directory Path to mock folder
-p port Webserver port
-u null Return different models for different user

Options marked with * are mandatory.mv m

Configuration file

This is a sample structure for a configuration file:

  "auth": {
    "headerField": "x-randomField" //optional (default to `x-userid`)
  "endpoints": [
      "url": "users",
      "base": "api/",
      "methods": ["GET"],
      "param": "id"
      "url": "posts",
      "base": "api/",
      "methods": ["GET", "POST"],
      "param": "id"

That will generate the following endpoints:

  • GET /api/users
  • GET /api/users/:id
  • GET /api/posts
  • GET /api/posts/:id
  • POST /api/posts
  • POST /api/posts/:id

MOCK Files

You can provide data to be loaded as a starting point for your development server. They should be located in the Mock Folder directory (-d option).

Examples for this files can be found in spec/mocks, anyway they are plain JSON arrays of objects.