dc8c8c3b916f687cdba3bd3dc8c9dc79cff2cbb9 — coltonhurst 2 months ago master
used gofmt
1 files changed, 11 insertions(+), 11 deletions(-)

M main.go
M main.go => main.go +11 -11
@@ 8,17 8,17 @@ // packages we want to import
  import (
  	"encoding/json"
+ 	"github.com/gorilla/mux" // mux = HTTP request multiplexer
  	"log"
  	"net/http"
- 	"github.com/gorilla/mux"	// mux = HTTP request multiplexer
  )
  
  // data objects
  type Person struct {
- 	ID				string 	 `json:"id,omitempty"`
- 	Firstname	string	 `json:"firstname,omitempty"`
- 	Lastname	string	 `json:"lastname,omitempty"`
- 	Address		*Address `json:"address,omitempty"`
+ 	ID        string   `json:"id,omitempty"`
+ 	Firstname string   `json:"firstname,omitempty"`
+ 	Lastname  string   `json:"lastname,omitempty"`
+ 	Address   *Address `json:"address,omitempty"`
  }
  type Address struct {
  	City  string `json:"city,omitempty"`


@@ 52,16 52,16 @@ /* -------------------- ROUTES -------------------- */
  
  func GetPeople(w http.ResponseWriter, r *http.Request) {
- 	json.NewEncoder(w).Encode(people)	// return the people array
+ 	json.NewEncoder(w).Encode(people) // return the people array
  }
  
  func GetPerson(w http.ResponseWriter, r *http.Request) {
  	params := mux.Vars(r)
- 	for _, item := range people {			// loop through the mapped names to check if the id param sent match any in the Person struct
+ 	for _, item := range people { // loop through the mapped names to check if the id param sent match any in the Person struct
  		if item.ID == params["id"] {
-       json.NewEncoder(w).Encode(item)
-       return
-     }
+ 			json.NewEncoder(w).Encode(item)
+ 			return
+ 		}
  	}
  }
  


@@ 83,4 83,4 @@ }
  		json.NewEncoder(w).Encode(people)
  	}
- }> 
\ No newline at end of file
+ }