Пример #1
0
func GetNodes(c *gin.Context) {
	nodes, err := store.GetNodeList(c)
	if err != nil {
		c.String(400, err.Error())
	} else {
		c.JSON(200, nodes)
	}
}
Пример #2
0
func ShowNodes(c *gin.Context) {
	user := session.User(c)
	nodes, _ := store.GetNodeList(c)
	token, _ := token.New(token.CsrfToken, user.Login).Sign(user.Hash)
	c.HTML(http.StatusOK, "nodes.html", gin.H{"User": user, "Nodes": nodes, "Csrf": token})
}