aboutsummaryrefslogblamecommitdiff
path: root/http_template.go
blob: 96338a35a34edec286b55c4834e61dfe34f5bd38 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                 

                                                                               





                                                                                                       
package main

import "net/http"

// render_template abstracts out the annoyances of reporting template rendering
// errors.
func render_template(w http.ResponseWriter, template_name string, params map[string]any) {
	err := templates.ExecuteTemplate(w, template_name, params)
	if err != nil {
		http.Error(w, "Error rendering template: "+err.Error(), http.StatusInternalServerError)
	}
}