// 跨域中间件 module.exports = (DOMAIN = '*') => { return (req, res, next) => { res.set('Access-Control-Allow-Headers', req.headers['access-control-request-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(); }; };