dmock-server
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i dmock-server

Weekly Downloads

2,163

Version

2.0.5

License

Apache 2.0

Unpacked Size

21.5 kB

Total Files

6

Last publish

Collaborators

  • danitseitlin