mocki

0.3.3 • Public • Published

Mocki

npm version Coverage Status

Mocki is a tool that lets you create Mock REST and GraphQL APIs.

Support for

  • Simulated failures
  • Simulated delays
  • Randomized reponses
  • Conditional resposes
  • Fake data generation

Getting Started

  1. Install Mocki npm install -g mocki

  2. Create a config YAML-file using the structure in .mocki/config.yml

    Hello world example:

     name: mocki
     port: 3000
     endpoints:
       - path: /hello
         method: get
           responses:
             - statusCode: 200
               body:
                 message: Hello from Mocki!
    
  3. Start your mock by running mocki run --path ./path/to/config.yml

  4. Test your mock by running curl http://localhost:3000

    { "message": "Hello World!" }
    

Prerequisites

We recommend using nvm to manage Node versions

  • npm > 6
  • node > 12

Documentation

Documentation is available at Mocki.io

Publishing a new version

  1. Create tag from latest commit: git tag vX.Y.Z
  2. Push tag: git push origin vX.Y.Z
  3. Publish to npm: npm publish
  4. Update coverage report: npm run coverage

Readme

Keywords

none

Package Sidebar

Install

npm i mocki

Homepage

mocki.io

Weekly Downloads

11

Version

0.3.3

License

ISC

Unpacked Size

96 kB

Total Files

30

Last publish

Collaborators

  • keaeriksson