1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| app.use(async (ctx, next) => { ctx.set("Access-Control-Allow-Origin", "*");
ctx.set("Access-Control-Allow-Methods", "OPTIONS, GET, PUT, POST, DELETE");
ctx.set("Access-Control-Allow-Headers", "x-requested-with, accept, origin, content-type");
ctx.set("Content-Type", "application/json;charset=utf-8");
ctx.set("Access-Control-Allow-Credentials", true);
ctx.set("Access-Control-Max-Age", 300);
ctx.set("Access-Control-Expose-Headers", "myData"); await next(); })
|