Beispiel #1
0
func main() {
	kingpin.Parse()
	r, err := recipes.NewRecipe(*name)
	if err != nil {
		log.Fatal(err)
	}
	m := r.GetMethod(*temp)
	b, _ := json.MarshalIndent(m, "", "  ")
	fmt.Println(string(b))
}
Beispiel #2
0
func GetRecipe(w http.ResponseWriter, req *http.Request) {
	args := GetArgs(req)
	recipe, err := recipes.NewRecipe(args.Vars["name"])
	if err != nil {
		return // err
	}
	temp := getTemperature(args)
	method := recipe.GetMethod(temp)
	json.NewEncoder(w).Encode(method)
}