示例#1
0
文件: app.go 项目: bardusco/tsuru
func AppList(w http.ResponseWriter, r *http.Request, u *auth.User) error {
	apps, err := app.List(u)
	if err != nil {
		return err
	}
	if len(apps) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	return json.NewEncoder(w).Encode(apps)
}
示例#2
0
文件: app.go 项目: astaxie/tsuru
func AppList(w http.ResponseWriter, r *http.Request, u *auth.User) error {
	apps, err := app.List(u)
	if len(apps) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	b, err := json.Marshal(apps)
	if err != nil {
		return err
	}
	fmt.Fprint(w, string(b))
	return nil
}
示例#3
0
文件: app.go 项目: nemx/tsuru
func appList(w http.ResponseWriter, r *http.Request, t *auth.Token) error {
	u, err := t.User()
	if err != nil {
		return err
	}
	rec.Log(u.Email, "app-list")
	apps, err := app.List(u)
	if err != nil {
		return err
	}
	if len(apps) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	return json.NewEncoder(w).Encode(apps)
}