3.0.0 • Published 5 years ago

koa-response-jsonp v3.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

koa-response-jsonp

NPM version Node version Build Status Coverage Status npm download

koa jsonp middleware

Install

npm install koa-response-jsonp --save

Usage

const Koa = require('koa');
const app = new Koa();
const jsonp = require('koa-response-jsonp');

jsonp(app);

app.use(async ctx => {
	ctx.jsonp({
		success: true
	});
});

app.listen(3000);

then you request http://localhost:3000?callback=fn will response:

fn({"success":true})

custom callback functoin name:

jsonp(app, {
	callbackFn: 'cb'
});
3.0.0

5 years ago

2.1.0

5 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago