【跨域配置修改、端口修改】
This commit is contained in:
parent
088449ce2d
commit
5a7e2cb280
4
go.mod
4
go.mod
|
@ -4,7 +4,9 @@ go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/appleboy/gin-jwt/v2 v2.9.1
|
github.com/appleboy/gin-jwt/v2 v2.9.1
|
||||||
|
github.com/gin-contrib/cors v1.4.0
|
||||||
github.com/gin-contrib/zap v0.1.0
|
github.com/gin-contrib/zap v0.1.0
|
||||||
|
github.com/golang/protobuf v1.5.3
|
||||||
github.com/panjf2000/gnet/v2 v2.3.1
|
github.com/panjf2000/gnet/v2 v2.3.1
|
||||||
github.com/spf13/viper v1.16.0
|
github.com/spf13/viper v1.16.0
|
||||||
github.com/swaggo/files v1.0.1
|
github.com/swaggo/files v1.0.1
|
||||||
|
@ -19,14 +21,12 @@ require (
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||||
github.com/gin-contrib/cors v1.4.0 // indirect
|
|
||||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||||
github.com/go-openapi/spec v0.20.9 // indirect
|
github.com/go-openapi/spec v0.20.9 // indirect
|
||||||
github.com/go-openapi/swag v0.22.4 // indirect
|
github.com/go-openapi/swag v0.22.4 // indirect
|
||||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
|
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -41,8 +41,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
|
||||||
github.com/appleboy/gin-jwt/v2 v2.9.1 h1:l29et8iLW6omcHltsOP6LLk4s3v4g2FbFs0koxGWVZs=
|
github.com/appleboy/gin-jwt/v2 v2.9.1 h1:l29et8iLW6omcHltsOP6LLk4s3v4g2FbFs0koxGWVZs=
|
||||||
github.com/appleboy/gin-jwt/v2 v2.9.1/go.mod h1:jwcPZJ92uoC9nOUTOKWoN/f6JZOgMSKlFSHw5/FrRUk=
|
github.com/appleboy/gin-jwt/v2 v2.9.1/go.mod h1:jwcPZJ92uoC9nOUTOKWoN/f6JZOgMSKlFSHw5/FrRUk=
|
||||||
github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS3rf4=
|
github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS3rf4=
|
||||||
|
|
5
init.go
5
init.go
|
@ -32,7 +32,10 @@ func InitServer() *gin.Engine {
|
||||||
|
|
||||||
engine := gin.New()
|
engine := gin.New()
|
||||||
|
|
||||||
engine.Use(cors.Default())
|
conf := cors.DefaultConfig()
|
||||||
|
conf.AllowHeaders = []string{"*"}
|
||||||
|
conf.AllowAllOrigins = true
|
||||||
|
engine.Use(cors.New(conf))
|
||||||
|
|
||||||
engine.Use(ginzap.Ginzap(zap.L(), time.DateTime, false))
|
engine.Use(ginzap.Ginzap(zap.L(), time.DateTime, false))
|
||||||
// gin panic 异常处理,默认处理为 engine.Use(ginzap.RecoveryWithZap(zap.L(), true))
|
// gin panic 异常处理,默认处理为 engine.Use(ginzap.RecoveryWithZap(zap.L(), true))
|
||||||
|
|
|
@ -3,7 +3,7 @@ env: dev
|
||||||
# 服务配置
|
# 服务配置
|
||||||
server:
|
server:
|
||||||
# 服务端口
|
# 服务端口
|
||||||
port: 8080
|
port: 9091
|
||||||
# 动力学端口配置
|
# 动力学端口配置
|
||||||
dynamics:
|
dynamics:
|
||||||
ip: 192.168.3.5
|
ip: 192.168.3.5
|
||||||
|
|
Loading…
Reference in New Issue