Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doc-service
Project
Project
Details
Activity
Releases
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
eifel邓鹏飞
doc-service
Commits
6b1e3a49
Commit
6b1e3a49
authored
Aug 14, 2024
by
shaol~
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置
parent
d5a73571
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
main.go
main.go
+4
-0
apiRouters.go
routers/apiRouters.go
+2
-1
No files found.
main.go
View file @
6b1e3a49
...
...
@@ -2,11 +2,15 @@ package main
import
(
"doc-service/routers"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
)
func
main
()
{
r
:=
gin
.
Default
()
store
:=
cookie
.
NewStore
([]
byte
(
"secret111"
))
r
.
Use
(
sessions
.
Sessions
(
"mysession"
,
store
))
r
.
GET
(
"/test"
,
func
(
c
*
gin
.
Context
)
{
c
.
String
(
200
,
"值是%v"
,
"hello word"
)
})
...
...
routers/apiRouters.go
View file @
6b1e3a49
...
...
@@ -2,12 +2,13 @@ package routers
import
(
"doc-service/controllers"
"doc-service/middlewares"
"github.com/gin-gonic/gin"
)
func
ApiRoutersInit
(
r
*
gin
.
Engine
)
{
apiRouters
:=
r
.
Group
(
"/api"
)
//middlewares.InitMiddleware
apiRouters
:=
r
.
Group
(
"/api"
,
middlewares
.
InitMiddleware
)
//middlewares.InitMiddleware
{
apiRouters
.
GET
(
"/index"
,
controllers
.
ApiController
{}
.
Index
)
}
...
...
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