
npm上至少有一个中间件用于处理Express中的CORS:cors。[请参阅@mscdex答案]
这是从ExpressJS
DOC设置自定义响应头的方法
res.set(field, [value])
将标题字段设置为值
res.set('Content-Type', 'text/plain');或传递一个对象以一次设置多个字段。
res.set({ 'Content-Type': 'text/plain', 'Content-Length': '123', 'ETag': '12345'})别名为
res.header(field, [value])