package main import ( “fmt” “github.com/codegangsta/negroni” “github.com/gorilla/mux” “encoding/json” “net/http” “github.com/elbuo8/4square-venues” ) func main() { mux := mux.NewRouter() mux.HandleFunc(“/”, IndexHandler).Methods(“GET”) mux.HandleFunc(“/venues/{query}”, FoursquareHandler).Methods(“GET”) n := negroni.Classic() n.UseHandler(mux) n.Run(“:3000”) } func IndexHandler(w http.ResponseWriter, r *http.Request){ p := “Page” fmt.Fprintf(w, “Home %s\n”, p) } func FoursquareHandler(w http.ResponseWriter, r *http.Request){ vars := mux.Vars(r) category := vars[“query”] fs := fsvenues.NewFSVenuesClient(“FOURSQUARE_ID”, “FOURSQUARE_SECRET”) […]
Categories