新增自定义的 Cors
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
config2 "fusenapi/server/data-transfer/internal/config"
|
||||
handler2 "fusenapi/server/data-transfer/internal/handler"
|
||||
svc2 "fusenapi/server/data-transfer/internal/svc"
|
||||
"fusenapi/utils/auth"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
@@ -19,7 +21,9 @@ func main() {
|
||||
var c config2.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCors())
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
}))
|
||||
defer server.Stop()
|
||||
|
||||
ctx := svc2.NewServiceContext(c)
|
||||
|
||||
Reference in New Issue
Block a user