Basic middleware: Code | Test
Negroni router: Code | Test
Alice with Gorilla Handlers: Code
Passing data with context: Code | Test
Exercises
Exercise 1
Take the Negroni code from example 2 and extend the code by adding a new middleware handler to validate authentication. This call must happen before processing anything else. If authentication fails return a 500 and cancel the processing of the request. If authentication succeeds finish processing the rest of the handlers. Use a query string to cause authentication to succeed or fail.