[go-nuts] Re: Can anyone show an example of using Context in net.http middleware?

2016-09-02 Thread fabrizio . blanco
H On Friday, September 2, 2016 at 12:39:16 PM UTC-7, kevin.nor...@gmail.com wrote: > > If I understand correctly using Context will allow "middleware" to pass > data into the handler? Can someone provide a simple example please. > > > > -- You received this message because you are subscribed

[go-nuts] Re: Can anyone show an example of using Context in net.http middleware?

2016-09-02 Thread fabrizio . blanco
Here is an example: https://play.golang.org/p/3mFS_7-mM8 You have two wrapper handlers (logIt and authIt). authIt, authenticates every handler you want to authenticate. For simplicity it takes a user id from a url and checks roles. logIt is another wrapper handler, that logs every handler and it