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