Skip to content

Instantly share code, notes, and snippets.

@johan-lejdung
Last active August 5, 2019 19:09
Show Gist options
  • Save johan-lejdung/b6d01f07365b549a68a4af2746e850f7 to your computer and use it in GitHub Desktop.
Save johan-lejdung/b6d01f07365b549a68a4af2746e850f7 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/johan-lejdung/go-microservice-middleware-guide/mw"
"github.com/urfave/negroni"
)
func main() {
router := mux.NewRouter()
router.
Methods("GET").
Path("/").
HandlerFunc(endpointHandler)
n := negroni.New()
n.Use(&mw.Logger{})
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