Socket
Socket
Sign inDemoInstall

10mock

Package Overview
Dependencies
66
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    10mock

Mid testing mock server for client-side testing.


Version published
Weekly downloads
63
decreased by-28.41%
Maintainers
2
Install size
1.73 MB
Created
Weekly downloads
 

Readme

Source

10mock

mockserver is a lightweight library that will help you mock your APIs requests fast and easy.

Installation

10mock can be installed globally :

npm install -g 10mock

10mock -p 8080
[10mock]: Server is running at http://localhost:8080

or as a regular NPM module:

npm install -D 10mock
npx 10mock

[10mock]: Server is running at http://localhost:8000

Available options:

  1. -p <port> run the mock server on the specified port, default port is 8000.
  2. -x <server url> run the mock server as proxy server

10mock also supplies easy to use client:

import Api from '10mock';
export const api = new Api(optional-port);

10mock server client usage:

  1. api.finishTest() - remove all mocked routes.
  2. api.nock(path).method(method).status(status).send(mocked-response);
  • Create new mocked route → returns object with these entities:
    • getCount → function thats returns the number of requests sent to this route.
    • getStubRequests → function thats returns all the requests sent to this route.
    • getStats → function thats returns getStubRequests and getCount results.
    • deleteRoute → function thats remove this mocked route.

Keywords

FAQs

Last updated on 27 May 2021

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