login page tweaks

This commit is contained in:
Nazar Kanaev
2021-03-17 12:17:17 +00:00
parent 73b7144394
commit 85a114e591
5 changed files with 26 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package router
import (
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
"strconv"
@@ -34,6 +35,12 @@ func (c *Context) JSON(status int, data interface{}) {
c.Out.Write([]byte("\n"))
}
func (c *Context) HTML(status int, tmpl *template.Template, data interface{}) {
c.Out.WriteHeader(status)
c.Out.Header().Set("Content-Type", "text/html")
tmpl.Execute(c.Out, data)
}
func (c *Context) VarInt64(key string) (int64, error) {
if val, ok := c.Vars[key]; ok {
return strconv.ParseInt(val, 10, 64)