21 lines
346 B
Go
21 lines
346 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
|
|
"github.com/gin-contrib/sessions"
|
|
"github.com/gin-contrib/sessions/cookie"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func TestMain(t *testing.T) {
|
|
eg := gin.New()
|
|
|
|
eg.Use(sessions.Sessions(SessionUser, cookie.NewStore([]byte("yame"))))
|
|
eg.Use(auth)
|
|
|
|
eg.POST("/api/login", login)
|
|
log.Fatal(eg.Run(":3001"))
|
|
}
|