Пример #1
0
// Generates randomly filled User JSON object
// Responses:
//   200 OK - return JSON object of user
func GetUser(w http.ResponseWriter, req *http.Request) {
	if req.Method != "GET" {
		sendString(w, http.StatusNotFound, "Not Found")
		return
	}
	sendJson(w, http.StatusOK, user.Generate())
}
Пример #2
0
// Generates user and tries to find campaign by user profile and max price
// Responses:
//    200 OK - return winner struct as Json object
//    400 Bad Request - return error string
func SearchAuto(w http.ResponseWriter, req *http.Request) {
	if req.Method != "GET" {
		sendString(w, http.StatusNotFound, "Not Found")
		return
	}
	sendJson(w, http.StatusOK, bidding.ProcessBid(user.Generate()))
}