Example #1
0
/**
 * 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))
}
Example #2
0
/**
 * 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))
}
Example #3
0
	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
 */