1.5.3 • Published 10 years ago

webservice-simulator v1.5.3

Weekly downloads
33
License
MIT
Repository
github
Last release
10 years ago

webservice-simulator

NPM version

Webservice-simulator is simple use module, by which you can build up your backend webservice quickly without any help from the backend team/developer.

Story

As a front-end developer, have you ever had the experience of asking back-end developer to provide a worked web-service even a mock, just for not blocking your task. But they ignore your request?

That's why i wrote the webservice-simulator.

Installation

npm install webservice-simulator --save-dev

Usage

var path = require('path');
var Simulator = require('webservice-simulator');

new Simulator({
    port: 9900,
    routerDir: path.resolve(__dirname, 'routers')
}).start();

By doing as above, you've launched an http server:

  • Listening on 9900
  • Serve route configurations from path.resolve(__dirname, 'routers')

API

Simulator(options)

options

Type: Object

Options to pass to new Simulator

options.port

Type: Number

Default: 3000

The port of the server which you want to listen.

options.routerDir

Type: String

Default: ./routers

The route configurations directory from where webservice-simulator read config files and configure the server.

How to write route configuration file

Play with example

Clone webservice-simulator

git clone git@github.com:leftstick/webservice-simulator.git

install dependencies

cd webservice-simulator
npm install

you may want to use a more efficient by sero-cli

launch example

example/example.js

play

Now, you have the simulator setup. which provides following apis:

  • /hello, for get http method
  • /askfordata, for websocket interreaction
  • /2.jpg, to access the static file

Make your client send those request. And see the response.

LICENSE

MIT License

1.5.3

10 years ago

1.5.2

10 years ago

1.5.1

11 years ago

1.5.0

11 years ago

1.4.0

11 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago