func Api(w http.ResponseWriter, r *http.Request) { manifest, _ := json.ReadJsonFile("public/assets/manifest.json") clientFileName := manifest["assets"].(map[string]interface{})["client.js"] w.Header().Set("Content-Type", "text/javascript") w.Header().Add("Cache-Control", fmt.Sprintf("max-age=%d, public, must-revalidate, proxy-revalidate", 300)) fmt.Fprintf(w, bootStrapJS, clientFileName) }
func (config *Config) Load() { data, err := json.ReadJsonFile(config.filePath) if err != nil { panic(err) } else { config.data = data } }