Last active
August 5, 2019 19:09
-
-
Save johan-lejdung/b6d01f07365b549a68a4af2746e850f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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