How Egg supports cross-domain requests for a single interface

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 ~

Dec.25,2021

https://github.com/eggjs/egg-.

https://eggjs.org/zh-cn/basic.


finally found that it was blocked by the user login layer ~

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35276-4d60c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35276-4d60c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?