this.express.use(
(req: express.Request, res: express.Response, next: express.NextFunction) => {
res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
res.header(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Control-Allow-Credentials"
);
res.header("Access-Control-Allow-Credentials", "true");
next();
}
);
this.express.use(cors());
Example: