const express = require("express");
const app = express();
app.all("*", (req, res, next) => {
res.header("Content-Type", "text/plain;charset=utf-8")
//设置允许跨域的域名,*代表允许任意域名跨域
res.header("Access-Control-Allow-Origin", "*")
//跨域允许的请求方式
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS")
//允许的header类型
res.header("Access-Control-Allow-Headers", "x-requested-with,content-type")
//设置响应头信息
res.header("X-Powered-By", ‘ 3.2.1‘)
next()
})