router.go 534 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()
	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)
	return router
}