This is first part we will be “dockerizing” a simple node application and pushing the image to docker hub. App structure will be simple and look like this. We will run a simple node server. Dockerfile will have the following instructions to build our image. Now to build our image using the instructions in our […]
Fetching venues from Foursquare using Go
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”) […]
I run most of my node apps on a droplet with DigitalOcean. Recently there was an issue and the droplet had to be restarted by them, but my app didn’t restart. This was a big issue for me and my client. I use Forever to run the app, but this only works if the app […]