We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @shijuvar I've read this example in chapter 6
router := mux.NewRouter() adminRoutes := mux.NewRouter() // add admin routes here // Create a new negroni for the admin middleware router.Handle("/admin", negroni.New( Middleware1, Middleware2, negroni.Wrap(adminRoutes), ))
But this piece of code
router.Handle("/admin", negroni.New( Middleware1, Middleware2, negroni.Wrap(adminRoutes), ))
seem not work. When visit url http://localhost:8080/admin or http://localhost:8080/admin/dashboard both seem the handlers for /admin not executed.
http://localhost:8080/admin
http://localhost:8080/admin/dashboard
/admin
This is my handlers for /admin route
// adminRouter routes adminRoutes.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println("/admin") fmt.Fprintf(w, "/admin") })) adminRoutes.Handle("/dashboard", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println("/admin/dashboard") fmt.Fprintf(w, "dashboard page") }))
What wrong with my code? Your book so great. Thanks
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi @shijuvar
I've read this example in chapter 6
But this piece of code
seem not work. When visit url
http://localhost:8080/admin
orhttp://localhost:8080/admin/dashboard
both seem the handlers for
/admin
not executed.This is my handlers for
/admin
routeWhat wrong with my code? Your book so great.
Thanks
The text was updated successfully, but these errors were encountered: