@indieatom/mockee

1.0.6 • Public • Published

A simple JSON based mock server

GitHub issues node NPM Version npm bundle size Downloads Stats

const mockee = require('@indieatom/mockee')
mockee()

The lightest way to mock your API calls just defining a JSON in your project.

Installation

npm install @indieatom/mockee --save

# OR

yarn add @indieatom/mockee

Usage

This package is based on a JSON that contains all your mockable request. Must be like:

{
    "GET": {
        "/your/mocked/route/": {
            "body": [{ "name": "Jordan" }]
        },
        "/route/with/expected/code/": {
            "code": 503
        }
    },
    "POST": {},
    "PUT": {},
    "DELETE": {}
}

That file could be saved in any directory inside your project and must be parsed to mockee().

const mockee = require('@indieatom/mockee')

// That accept your mock config by params
const mockeeConfig = {
    mock: './mock/my_mock.json', // JSON mock file path location
    port: 1234, // Mock server port (Default 4004)
    loader: 'https://github.com' // Optinal server to load data (Set '' to use dafult not found rule)
}

mockee(mockeeConfig)

Meta

Indie Atom – indieatom@gmail.com

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/indieatom/mockee/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Readme

Keywords

Package Sidebar

Install

npm i @indieatom/mockee

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

69.6 kB

Total Files

11

Last publish

Collaborators

  • rochajg