Skip to content

danitseitlin/dmock-server

Repository files navigation

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.

About

Mock server built for automation and ongoing development.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •