func roomGET(c *gin.Context) { roomid := c.Param("roomid") userid := fmt.Sprint(rand.Int31()) c.HTML(200, "chat_room", gin.H{ "roomid": roomid, "userid": userid, }) }
func indexFunc(c *gin.Context) { w, _ := env.db.PickOne() const layout = "Jan 2, 2006 at 3:04pm" retrievedat := w.RetrievedAt.Format(layout) c.HTML(http.StatusOK, "index", gin.H{ "title": strings.Title(APPNAME), "retrievedat": retrievedat, "lemma": w.Lemma, "definitions": w.Definitions, }) }
func roomGET(c *gin.Context) { roomid := c.Param("roomid") nick := c.Query("nick") if len(nick) < 2 { nick = "" } if len(nick) > 13 { nick = nick[0:12] + "..." } c.HTML(200, "room_login.templ.html", gin.H{ "roomid": roomid, "nick": nick, "timestamp": time.Now().Unix(), }) }