krj

koa-response-jsonp

koa jsonp middleware

Showing:

Popularity

Downloads/wk

8

GitHub Stars

3

Maintenance

Last Commit

4mos ago

Contributors

5

Package

Dependencies

1

Size (min+gzip)

2.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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'
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100