middleware/

directory
v0.0.0-...-b3f521c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2017 License: Apache-2.0

README

Web - Middleware

Learn the basics of using and applying middleware.

Notes

  • The standard library has much of what you need to build services and apps.
  • The http package provides the building blocks.
  • There are other great packages in the Go ecosystem to help.

https://golang.org/pkg/net/http/
https://golang.org/doc/articles/wiki/
github.com/urfave/negroni
github.com/gorilla/handlers

Code Review

Basic middleware: Code | Test
Negroni router: 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.


All material is licensed under the Apache License Version 2.0, January 2004.

Directories

Path Synopsis
Sample program to show how to apply middleware.
Sample program to show how to apply middleware.
Sample program to show how to apply middleware using negroni.
Sample program to show how to apply middleware using negroni.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL