Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including nodejs-mock-server with all npm packages installed. Try it out:

var nodejsMockServer = require("nodejs-mock-server")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

nodejs-mock-server v0.0.14

a dev mock server for nodejs project

nodejs-mock-server

A dev mock server for nodejs project, focus on improving development efficiency

Getting Started

1. Install npm package:

$ npm install nodejs-mock-server --save-dev

2. Init mock-server:

// Boot 
const express = require('express')

require('nodejs-mock-server')

const app = express()

// init mock-server
MS.init({
  app,
  appDir: __dirname
})

// add intercept
app.use('/api/*', MS.intercept())

demo: nodejs-simple-demo

3. Visit /mock-server/#/

Usage Example

Guide && Schematic Diagram

TODO List

  • [x] dev server

  • [x] request/response intercept

  • [x] guide && schematic diagram

  • [ ] add mock feature with mockjs

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free