Permalink
Browse files

Added app engine example

  • Loading branch information...
1 parent fe49eb8 commit 85c4867c533468474ef22ce4cbcdb65544e0eaab @wickedchicken wickedchicken committed May 13, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 example/hello_appengine.go
View
@@ -0,0 +1,23 @@
+// hello.go ported for app engine
+
+package patexample
+
+import (
+ "io"
+ "net/http"
+ "pat"
+)
+
+// hello world, the web server
+func HelloServer(w http.ResponseWriter, req *http.Request) {
+ io.WriteString(w, "hello, "+req.URL.Query().Get(":name")+"!\n")
+}
+
+func init() {
+ m := pat.New()
+ m.Get("/hello/:name", http.HandlerFunc(HelloServer))
+
+ // Register this pat with the default serve mux so that other packages
+ // may also be exported. (i.e. /debug/pprof/*)
+ http.Handle("/", m)
+}

0 comments on commit 85c4867

Please sign in to comment.