Skip to content
New issue

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

In chapter six, middleware doesn't work #4

Open
mnazarani opened this issue Oct 18, 2015 · 7 comments
Open

In chapter six, middleware doesn't work #4

mnazarani opened this issue Oct 18, 2015 · 7 comments

Comments

@mnazarani
Copy link

Any path added to secureRouter returns 404 - page not found error.

@snikch
Copy link
Contributor

snikch commented Nov 5, 2015

Hey @mnazarani, are you able to post your code here so I can check it out for you? Cheers

@dmikalova
Copy link

I am getting the same error in chapter 7. Running the code from 7-3 of your repo gives me:
./main.go:69: cannot use func literal (type func(http.ResponseWriter, *http.Request)) as type http.Handler in assignment: func(http.ResponseWriter, *http.Request) does not implement http.Handler (missing ServeHTTP method)

I think from following the book I arrived at
func NewRouter() *httprouter.Router { router := httprouter.New() return router } which does compile but gives the 404s mentioned above.

@dmikalova
Copy link

Finaslly had more time to track this down - the issue is with vendoring - if you use godeps (as stated in the book) then it works. You may want to add a readme stating as much.

@snikch
Copy link
Contributor

snikch commented Dec 16, 2015

Good news @dmikalova. Sorry I missed your previous comment!

@snikch
Copy link
Contributor

snikch commented Dec 16, 2015

Just checking, when you say adding a readme, you mean to this repo?

@dmikalova
Copy link

Yeah, to the top level just so new readers don't end up as stupid as me :)

@snikch
Copy link
Contributor

snikch commented Dec 16, 2015

👍

@snikch snikch mentioned this issue Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants