Socket
Socket
Sign inDemoInstall

mockttp

Package Overview
Dependencies
82
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mockttp

Make mock http servers


Version published
Weekly downloads
79K
decreased by-7.46%
Maintainers
1
Install size
7.63 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 09 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc