how Egg supports cross-domain requests for a single interface, but not all interfaces of the service can be cross-domain requests ~
tried the following method:
async XXX () {
const { ctx } = this;
ctx.set("Access-Control-Allow-Origin", "*");
ctx.set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, token");
ctx.set("Access-Control-Allow-Credentials", true);
ctx.set("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS, DELETE");
...
}
but:
ask for advice ~