handlers and render funcs take apart
This commit is contained in:
16
render.go
Normal file
16
render.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string) {
|
||||
parsedTemplate, _ := template.ParseFiles("./templates/" + tmpl)
|
||||
err := parsedTemplate.Execute(w, nil)
|
||||
if err != nil {
|
||||
fmt.Println("error parsing template:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user