Skip to content
Browse files

Added Silence Middleware example

  • Loading branch information...
1 parent 301e3e2 commit a8d0186ac92a184be2f5ed20c713588c513942a3 @victorcoder victorcoder committed Oct 22, 2011
Showing with 22 additions and 1 deletion.
  1. +1 −1 examples/Makefile
  2. +21 −0 examples/silence.go
View
2 examples/Makefile
@@ -1,6 +1,6 @@
include $(GOROOT)/src/Make.inc
-BINS=hello logger session routing cats
+BINS=hello logger session routing cats silence
LIBS=cats_middleware.a silence_middleware.a
all: $(LIBS) $(BINS)
View
21 examples/silence.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+ "mango"
+ "silence_middleware"
+)
+
+// Our default handler
+func Hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) {
+ //Return 500 to trigger the silence
+ return 500, mango.Headers{}, mango.Body("Hello World!")
+}
+
+func main() {
+ stack := new(mango.Stack)
+ stack.Address = ":3000"
+
+ stack.Middleware(silence.SilenceErrors) // Include our custom middleware
+
+ stack.Run(Hello)
+}

0 comments on commit a8d0186

Please sign in to comment.
Something went wrong with that request. Please try again.