Skip to content

Instantly share code, notes, and snippets.

@johan-lejdung
Last active August 5, 2019 18:56
Show Gist options
  • Save johan-lejdung/08f97e231405d728bdd6bd97cfb515be to your computer and use it in GitHub Desktop.
Save johan-lejdung/08f97e231405d728bdd6bd97cfb515be to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/urfave/negroni"
)
func main() {
router := mux.NewRouter()
router.
Methods("GET").
Path("/").
HandlerFunc(endpointHandler)
n := negroni.New()
n.UseHandler(router)
err := http.ListenAndServe(":8080", n)
if err != nil {
panic(err)
}
}
func endpointHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println("Endpoint handler called")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment