Skip to content

Commit

Permalink
add practical example wit koa v1/v2 🤠 ..
Browse files Browse the repository at this point in the history
  • Loading branch information
3imed-jaberi committed Jun 13, 2020
1 parent 6311139 commit 8eb86ee
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
15 changes: 0 additions & 15 deletions demo.js

This file was deleted.

15 changes: 15 additions & 0 deletions examples/koa-v1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const jsonp = require('.');
const koa = require('koa');

const app = koa();
jsonp(app, {
callback: '_callback' // default is 'callback'
});

app.use(function* () {
this.jsonp = { foo: 'bar' };
});

app.listen(1984);
15 changes: 15 additions & 0 deletions examples/koa-v2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const jsonp = require('.');
const Koa = require('koa');

const app = new Koa();
jsonp(app, {
callback: '_callback' // default is 'callback'
});

app.use(function (ctx) {
ctx.jsonp = { foo: 'bar' };
});

app.listen(1984);

0 comments on commit 8eb86ee

Please sign in to comment.