コード例 #1
0
ファイル: user.go プロジェクト: houssemFat/giny
/**
 * login
 */
func UserLogin(w http.ResponseWriter, request *http.Request, params map[string]string) {
	params["response"] = "login"
	data, err := json.Marshal(params)
	if err != nil {

	}
	giny.SendJsonResponse(w, string(data))
}
コード例 #2
0
ファイル: user.go プロジェクト: houssemFat/giny
/**
 * informations
 */
func UserInformations(w http.ResponseWriter, request *http.Request, params map[string]string) {
	user := &models.User{Name: "houssem", Username: "******", Id: 50}
	data, err := json.Marshal(user)
	if err != nil {

	}
	giny.SendJsonResponse(w, string(data))
}
コード例 #3
0
ファイル: user.go プロジェクト: houssemFat/giny
	if err != nil {

	}
	giny.SendJsonResponse(w, string(data))
}

/**
 * register
 */
var UserRegister = func(w http.ResponseWriter, request *http.Request, params map[string]string) {
	params["response"] = "register"
	data, err := json.Marshal(params)
	if err != nil {

	}
	giny.SendJsonResponse(w, string(data))
}

/**
 * get list
 */
var GetList = func(w http.ResponseWriter, request *http.Request, params map[string]string) {
	url := "http://jsonplaceholder.typicode.com/users"
	response := giny.GetJsonServerResponse(url)
	// id, err := strconv.Atoi(params["id"])
	giny.SendJsonResponse(w, response)
}

/**
 * get item based in id
 */