JSPM

  • Created
  • Published
  • Downloads 224488
  • Score
    100M100P100Q166219F
  • License MIT

Make mock http servers

Package Exports

  • mockttp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mockttp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mockttp

Mock HTTP REST Servers over local host

Usage

Install mockhttp

npm install --save-dev mockttp

Create the mockttp.json configuration file

[
  {
    "name": "Mock HTTP Test Server 1",
    "port": 1337,
    "endpoints": [
      {
        "method": "POST",
        "pattern": "/create",
        "response": {
          "status": 201,
          "data": {
            "name": "Lucas Vieira"
          }
        }
      }
    ]
  },
  {
    "name": "Mock HTTP Test Server 2",
    "port": 1338,
    "endpoints": [
      {
        "method": "GET",
        "pattern": "/show/:name",
        "response": {
          "status": 404,
          "data": {
            "message": "User Not Found"
          }
        }
      }
    ]
  }
]

mockttp supports the same routing patterns as restify

Run

./node_modules/.bin/mockttp