diff --git a/main.go b/main.go index 115c8c5..93a8246 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( ) type Page struct { + Host string Title string Body string } @@ -34,7 +35,7 @@ func index(w http.ResponseWriter, r *http.Request) { fmt.Printf("Token: %s Redirect to: %s \n", string(r.URL.Path[1:]), redirect) } else { t, _ := template.ParseFiles("template/index.gohtml") - t.Execute(w, nil) + t.Execute(w, Page{Title: "Shrt"}) } case "POST": var test string @@ -42,10 +43,9 @@ func index(w http.ResponseWriter, r *http.Request) { if err != nil { panic(err) } - P := Page{Title: r.FormValue("url"), Body: token} + P := Page{Title: "Url:", Body: r.Host + "/" + token} t, _ := template.ParseFiles("template/index.gohtml") t.Execute(w, P) - fmt.Println("Token by Url:", P) } } diff --git a/template/index.gohtml b/template/index.gohtml index 354faba..e03f918 100644 --- a/template/index.gohtml +++ b/template/index.gohtml @@ -4,6 +4,12 @@ Shrt