views

package
v0.0.0-...-5110490 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
}
View Source
var Panic = func(c *gin.Context) {
	panic("trigger err~")
}
View Source
var PanicUserErr = func(c *gin.Context) {
	panic(errors.UserPanicErr)
}
View Source
var Pong = func(c *gin.Context) {
	c.String(http.StatusOK, "hello world")
}
View Source
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())
}
View Source
var Welcome = func(c *gin.Context) {
	c.HTML(http.StatusOK, "welcome.tmpl", gin.H{
		"name": "laoguo",
	})
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL