Created
July 26, 2015 20:33
-
-
Save alyssaq/5af1f73a65d0b4a4ccb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func renderTemplate(w http.ResponseWriter, tmpl string, str string) { | |
var fp = path.Join("templates", "index.html") | |
var templates = template.Must(template.ParseFiles(fp)) | |
err := templates.ExecuteTemplate(w, tmpl+".html", str) | |
if err != nil { | |
http.Error(w, err.Error(), http.StatusInternalServerError) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment