Пример #1
0
func getTemplateSrc(name string) string {
	data, err := base.Asset(name)
	if err != nil {
		base.LogErr.Fatalf("template file is not founded: %s\n", name)
	}
	return string(data)
}
Пример #2
0
func staticHandler(w http.ResponseWriter, r *http.Request) {
	data, err := base.Asset("webui" + r.URL.Path)
	if err != nil {
		http.NotFound(w, r)
	}

	mimeType := mime.TypeByExtension(filepath.Ext(r.URL.Path))
	if mimeType != "" {
		w.Header().Add("Content-type", mimeType)
	}
	w.Write(data)
}