app.all('*', (req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With');
res.header('Access-Control-Allow-Methods', 'GET, POST, DELETE, PUT, OPTIONS');
res.header('X-Powered-By', ' 3.2.1');
if (req.method === 'OPTIONS') {
res.sendStatus(200);
} else {
next();
}
});
网友评论