Skip to content

julien/mocko

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mocko

A dumb http mock utility

Requirements

Node.js

Installation

npm install mocko

Usage

# start by passing a file path (and optional port)
node node_modules/.bin/mocko **route_file.json** *port*

Endpoints are defined in a json file

Example

{
  "/api/test": {

    "headers": {
      "Content-type": "application/json",
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Headers": "X-Requested-With"
    },

    "statusCode": 200,

    "body": {
      "name": "Something",
      "data": [1, 2, 3, 4, 5]
    }
  }
}

The only required property is the body but you can specify headers and a statusCode

Tests, etc...

  • Grab the dependencies

npm install

  • Run the tests

npm test

  • Generate coverage report

npm run cover

  • Lint source code

npm run lint

License

MIT

About

dumb http mock utility

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published