Files
SiteProxy/proxy/index.go
2025-12-15 01:45:57 +08:00

24 lines
577 B
Go

// proxy/index.go
package proxy
import (
"html/template"
"net/http"
)
type IndexHandler struct {
templates *template.Template
}
func NewIndexHandler(templates *template.Template) *IndexHandler {
return &IndexHandler{
templates: templates,
}
}
func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := h.templates.ExecuteTemplate(w, "index.html", nil); err != nil {
http.Error(w, "Internal server error", http.StatusInternalServerError)
}
}