// 跨域中间件 module.exports = (DOMAIN = '*') => { return (req, res, next) => { console.log(req.headers.origin); res.set('Access-Control-Allow-Headers', '*'); res.header('Access-Control-Allow-Origin', req.headers.origin); res.header('Access-Control-Allow-Credentials', true); res.header('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS'); next(); }; };