Skip to content
Snippets Groups Projects
Commit ee17aec5 authored by andmag's avatar andmag
Browse files

deploying heroku

parent 1613e3ea
No related branches found
No related tags found
No related merge requests found
......@@ -29,11 +29,8 @@ func speciesInCountryRequest(url string, c *http.Client, country *Country) {
// sends a request for species in a country and gets the response
resp := doRequest(url, c)
// array of results structs
type Result Results
// empty result struct
var nameAndKey = &Result{}
var nameAndKey = &Results{}
// decodes the response into the array of results
err := json.NewDecoder(resp.Body).Decode(nameAndKey)
......@@ -69,13 +66,12 @@ func HandlerCountry(w http.ResponseWriter, r *http.Request) {
// gets the query we want and splits the string into parts
urlQuery := r.URL.RawQuery
parts := strings.Split(r.URL.Path, "/")
/*
if len(parts) != 5 || parts[1] != "conservation" || parts[2] != "v1" || parts[3] != "country" || parts[4] == "" {
status := http.StatusBadRequest
http.Error(w, "Expecting format /conservation/v1/country/'AlphaCode'", status)
return
}
*/
if len(parts) != 5 || parts[1] != "conservation" || parts[2] != "v1" || parts[3] != "country" || parts[4] == "" {
status := http.StatusBadRequest
http.Error(w, "Expecting format /conservation/v1/country/'AlphaCode'", status)
return
}
// appends the country-code to the country api and appends country-code and limit to the species api
APIURL += parts[4]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment