router.go
796 Bytes
package main
import (
// "github.com/gin-contrib/cors"
_ "github.com/gin-gonic/autotls"
"github.com/gin-gonic/gin"
. "loginserver/apis"
// "net/http"
// "log"
)
func initRouter() *gin.Engine {
router := gin.Default()
// config := cors.DefaultConfig()
// config.AllowOrigins = []string{"http://127.0.0.1:8000", "http://47.95.36.186:8000", "http://47.95.36.186:8402", "http://47.95.36.186:8401"}
// config.AllowCredentials = true
// router.Use(cors.Default())
router.POST("user/login", UserLoginApi)
router.POST("user/register", UserRegisterApi)
router.POST("user/checkusername", CheckUserNameRepeatApi)
router.POST("user/changepassword", ChangeUserPasswordApi)
router.GET("user/checkloginstate", CheckUserLoginStateApi)
router.GET("user/logout", UserLogoutApi)
return router
}