Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rym-util
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengqiuyun
rym-util
Commits
ebb09a42
Commit
ebb09a42
authored
Aug 10, 2022
by
zhengqiuyun86
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化
parent
fc8c061a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-0
router.go
router/router.go
+8
-1
No files found.
go.mod
View file @
ebb09a42
...
...
@@ -12,6 +12,7 @@ require (
)
require (
github.com/gin-contrib/cors v1.4.0
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a
...
...
go.sum
View file @
ebb09a42
...
...
@@ -30,6 +30,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
...
...
router/router.go
View file @
ebb09a42
...
...
@@ -6,6 +6,7 @@ import (
"git.168cad.top/zhengqiuyun/rym-util/log"
"git.168cad.top/zhengqiuyun/rym-util/router/validator"
"git.168cad.top/zhengqiuyun/rym-util/util"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/render"
"github.com/swaggo/files"
...
...
@@ -13,9 +14,15 @@ import (
"net/http"
)
func
InitGinEngine
()
*
gin
.
Engine
{
func
InitGinEngine
(
canCors
bool
)
*
gin
.
Engine
{
gin
.
SetMode
(
gin
.
ReleaseMode
)
c
:=
gin
.
New
()
if
canCors
{
corsConfig
:=
cors
.
DefaultConfig
()
corsConfig
.
AllowAllOrigins
=
true
corsConfig
.
AllowHeaders
=
[]
string
{
"*"
}
c
.
Use
(
cors
.
New
(
corsConfig
))
}
//便于工具监测
c
.
GET
(
"/favicon.ico"
,
func
(
c
*
gin
.
Context
)
{
c
.
Render
(
http
.
StatusOK
,
render
.
String
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment