quick implementation of middleware

This commit is contained in:
luke.rodham
2018-03-12 10:08:30 +00:00
parent 6740568afb
commit 1e787689aa
12 changed files with 187 additions and 84 deletions
+12
View File
@@ -0,0 +1,12 @@
package middleware
import "github.com/lukerodham/tuu"
// RequestLogger is a default/example implementation of how a logging middleware would be implemented.
func RequestLogger(next tuu.Handler) tuu.Handler {
return func(c tuu.Context) error {
c.Logger().WithField("url", c.Value("path")).Debug("New request")
return next(c)
}
}