Back to godoc.org

Package views

v0.0.0-...-5110490
Latest Go to latest

The latest major version is .

Published: Dec 11, 2019 | License: MIT | Module: github.com/GalaIO/GoWebTemplateWithGin

Index

Variables

var Login = func(c *gin.Context) {
	var form loginForm
	if err := c.ShouldBind(&form); err != nil {
		utils.AbortGinError(c, err)
		return
	}

	token, err := auth.JwtGenerateToken(&auth.UserClaim{
		Id: "10000",
	})
	if err != nil {
		utils.AbortGinError(c, err)
		return
	}
	http.SetCookie(c.Writer, &http.Cookie{
		Name:  "jwt",
		Value: token,
	})
	c.String(http.StatusOK, "login success")
}
var Panic = func(c *gin.Context) {
	panic("trigger err~")
}
var PanicUserErr = func(c *gin.Context) {
	panic(errors.UserPanicErr)
}
var Pong = func(c *gin.Context) {
	c.String(http.StatusOK, "hello world")
}
var Us = func(c *gin.Context) {
	site, err := managers.GetBaseWebSiteInfo()
	if err != nil {
		c.JSON(http.StatusOK, site)
		return
	}
	c.String(http.StatusOK, err.Error())
}
var Welcome = func(c *gin.Context) {
	c.HTML(http.StatusOK, "welcome.tmpl", gin.H{
		"name": "laoguo",
	})
}
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier