aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go')
-rw-r--r--Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go b/Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go
new file mode 100644
index 000000000..851ac41d0
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/rs/cors/examples/default/server.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "net/http"
+
+ "github.com/rs/cors"
+)
+
+func main() {
+ h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ w.Write([]byte("{\"hello\": \"world\"}"))
+ })
+
+ // Use default options
+ handler := cors.Default().Handler(h)
+ http.ListenAndServe(":8080", handler)
+}