Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dmock-server

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmock-server

A typescript based mock server NPM module

  • 1.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3K
increased by9.43%
Maintainers
1
Weekly downloads
 
Created
Source

dMock Server · GitHub license npm version

About

This NodeJS module is a delightful mock server built for automation and ongoing development

Quick Start

Install the module

Run the following command in your terminal:

npm i dmock-server

Setup your mock

import { MockServer } from 'dmock-server';

//Initializing the mock server
const server = new MockServer({
    hostname: 'localhost',
    port: 3000,
    routes: [{
        method: 'get',
        path: '/users',
        response: this.users
    },{
        method: 'get',
        path: '/users/:id',
        response: (req) => this.getUser(req.params.id)
    }]
});

You can setup a function or a simple JS object as a response for a URL.
Once ready, you will need to run server.start() to start the server and server.stop() to stop it.

FAQs

Package last updated on 28 Jun 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc