1234567891011121314151617 |
- package view
-
- import (
- "html/template"
- "log"
- "net/http"
- )
-
- // Template rendering function
- func RenderTemplate(w http.ResponseWriter, templateFile string, templateData interface{}) {
-
- t, err := template.ParseFiles(templateFile)
- if err != nil {
- log.Fatal("Error encountered while parsing the template: ", err)
- }
- t.Execute(w, templateData)
- }
|