Skip to content

A simple JSON based mock server

Notifications You must be signed in to change notification settings

indieatom/mockee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 – [email protected]

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

About

A simple JSON based mock server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published