seesaw
v0.0.6
Published
a quick-setup springboard server working around cross-domain requests
Downloads
7
Readme
seesaw
a quick-setup springboard server working around client-side cross-domain requests
How to install
$ npm install seesaw
Using as Express middleware
var seesaw = require('seesaw').redirect;
// incert before custom routers
app.use('/someDir',seesaw('http://abc.com/apis')) // the base url you wanna mock
Use CLI
(now building...)
$ sudo npm install seesaw -g
$ swwsaw -r http://abc.com/apis -p 9999 // mock http://abc.com/apis running on port[9999]
Using as single springboard server
var Seesaw = require('seesaw');
// init a server instance
var server = new Seesaw('http://abc.com/apis'); // the base url you wanna mock
// start sever
server.run(1234);
How to seesaw ?
make sure your client-side scripts work like this:
// jQuery Demo:
// this request will be redirected by seesaw server to URL http://abc.com/apis/user/1234567
$.get('http://mockserver:port/user/1234567',function(result){
// and callback real response
});
Features
- quick setup
- develeoper friendly
- express middleware supported
Pull Request Welcome !
- fork this repo
- feel free to add your feature
- make sure your feature are fully tested!
- send me a PR, and enjoy !