refactor: reorganize modules and add Linux build tooling
This commit is contained in:
35
module/base/mgt/internal/logic/hello/ping.go
Normal file
35
module/base/mgt/internal/logic/hello/ping.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package hello
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Ping
|
||||
func Ping(ctx *gin.Context) {
|
||||
|
||||
// file, err := ctx.FormFile("fileContent")
|
||||
// if err != nil {
|
||||
// fmt.Println("err", err)
|
||||
// return
|
||||
// }
|
||||
|
||||
// ctx.SaveUploadedFile(file, "./tmp/"+file.Filename)
|
||||
// ctx.JSON(200, gin.H{
|
||||
// "msg": file,
|
||||
// })
|
||||
ctx.JSON(200, gin.H{"message": "Pong"})
|
||||
}
|
||||
func SessionDemo(ctx *gin.Context) {
|
||||
session := sessions.Default(ctx)
|
||||
session.Set("key", "12345")
|
||||
if err := session.Save(); err != nil {
|
||||
ctx.JSON(500, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
value := session.Get("key")
|
||||
fmt.Println("session value: ", value)
|
||||
ctx.JSON(200, gin.H{"message": "Pong"})
|
||||
}
|
||||
Reference in New Issue
Block a user