const koa = require("koa");
const app = new koa();
const router = require("koa-router")();
router.get("/jsonp",async ctx=>{
let callbackName = ctx.query.callback || 'callback'
// 返回jsonp
var obj ={
name:"cheng",
age:18
}
ctx.body = callbackName + `(${JSON.stringify(obj)})`
})
app.use(router.routes()).use(router.allowedMethods());
app.listen(7000)