コード例 #1
0
ファイル: main.go プロジェクト: agorobets/simple_dsp
// 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
ファイル: main.go プロジェクト: agorobets/simple_dsp
// 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()))
}