优化cors,更好的支持RESFULAPI

v1
宇天 2021-04-14 15:34:58 +08:00
parent 70a2df5583
commit 1d4940b903
2 changed files with 2 additions and 1 deletions

View File

@ -31,6 +31,7 @@ export default function(req, res, next) {
} }
res.set('Access-Control-Allow-Origin', `${protocol}//${host}`) res.set('Access-Control-Allow-Origin', `${protocol}//${host}`)
res.set('Access-Control-Allow-Methods', 'GET,HEAD,POST,PUT,DELETE,PATCH')
if (headers) { if (headers) {
res.set('Access-Control-Allow-Headers', headers) res.set('Access-Control-Allow-Headers', headers)

View File

@ -1,6 +1,6 @@
{ {
"name": "@gm5/core", "name": "@gm5/core",
"version": "1.0.2", "version": "1.0.3",
"type": "module", "type": "module",
"description": "Five.js, 一个轻量级的nodejs mvc框架 旨在简单易用, 5分钟即可上手", "description": "Five.js, 一个轻量级的nodejs mvc框架 旨在简单易用, 5分钟即可上手",
"author": "yutent <yutent.io@gmail.com>", "author": "yutent <yutent.io@gmail.com>",