aboutsummaryrefslogtreecommitdiff
path: root/src/vendor/github.com/rs/cors/examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/vendor/github.com/rs/cors/examples')
-rw-r--r--src/vendor/github.com/rs/cors/examples/alice/server.go24
-rw-r--r--src/vendor/github.com/rs/cors/examples/default/server.go19
-rw-r--r--src/vendor/github.com/rs/cors/examples/goji/server.go22
-rw-r--r--src/vendor/github.com/rs/cors/examples/martini/server.go23
-rw-r--r--src/vendor/github.com/rs/cors/examples/negroni/server.go26
-rw-r--r--src/vendor/github.com/rs/cors/examples/nethttp/server.go20
-rw-r--r--src/vendor/github.com/rs/cors/examples/openbar/server.go22
-rw-r--r--src/vendor/github.com/rs/cors/examples/xhandler/server.go24
8 files changed, 0 insertions, 180 deletions
diff --git a/src/vendor/github.com/rs/cors/examples/alice/server.go b/src/vendor/github.com/rs/cors/examples/alice/server.go
deleted file mode 100644
index 0a3e15c..0000000
--- a/src/vendor/github.com/rs/cors/examples/alice/server.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/justinas/alice"
- "github.com/rs/cors"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"http://foo.com"},
- })
-
- mux := http.NewServeMux()
-
- mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })
-
- chain := alice.New(c.Handler).Then(mux)
- http.ListenAndServe(":8080", chain)
-}
diff --git a/src/vendor/github.com/rs/cors/examples/default/server.go b/src/vendor/github.com/rs/cors/examples/default/server.go
deleted file mode 100644
index ccb5e1b..0000000
--- a/src/vendor/github.com/rs/cors/examples/default/server.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/rs/cors"
-)
-
-func main() {
- mux := http.NewServeMux()
- mux.HandleFunc("/", 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(mux)
- http.ListenAndServe(":8080", handler)
-}
diff --git a/src/vendor/github.com/rs/cors/examples/goji/server.go b/src/vendor/github.com/rs/cors/examples/goji/server.go
deleted file mode 100644
index 1fb4073..0000000
--- a/src/vendor/github.com/rs/cors/examples/goji/server.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/rs/cors"
- "github.com/zenazn/goji"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"http://foo.com"},
- })
- goji.Use(c.Handler)
-
- goji.Get("/", func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })
-
- goji.Serve()
-}
diff --git a/src/vendor/github.com/rs/cors/examples/martini/server.go b/src/vendor/github.com/rs/cors/examples/martini/server.go
deleted file mode 100644
index 081af32..0000000
--- a/src/vendor/github.com/rs/cors/examples/martini/server.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package main
-
-import (
- "github.com/go-martini/martini"
- "github.com/martini-contrib/render"
- "github.com/rs/cors"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"http://foo.com"},
- })
-
- m := martini.Classic()
- m.Use(render.Renderer())
- m.Use(c.HandlerFunc)
-
- m.Get("/", func(r render.Render) {
- r.JSON(200, map[string]interface{}{"hello": "world"})
- })
-
- m.Run()
-}
diff --git a/src/vendor/github.com/rs/cors/examples/negroni/server.go b/src/vendor/github.com/rs/cors/examples/negroni/server.go
deleted file mode 100644
index 3cb33bf..0000000
--- a/src/vendor/github.com/rs/cors/examples/negroni/server.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/codegangsta/negroni"
- "github.com/rs/cors"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"http://foo.com"},
- })
-
- mux := http.NewServeMux()
-
- mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })
-
- n := negroni.Classic()
- n.Use(c)
- n.UseHandler(mux)
- n.Run(":3000")
-}
diff --git a/src/vendor/github.com/rs/cors/examples/nethttp/server.go b/src/vendor/github.com/rs/cors/examples/nethttp/server.go
deleted file mode 100644
index eaa775e..0000000
--- a/src/vendor/github.com/rs/cors/examples/nethttp/server.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/rs/cors"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"http://foo.com"},
- })
-
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })
-
- http.ListenAndServe(":8080", c.Handler(handler))
-}
diff --git a/src/vendor/github.com/rs/cors/examples/openbar/server.go b/src/vendor/github.com/rs/cors/examples/openbar/server.go
deleted file mode 100644
index 0940423..0000000
--- a/src/vendor/github.com/rs/cors/examples/openbar/server.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/rs/cors"
-)
-
-func main() {
- c := cors.New(cors.Options{
- AllowedOrigins: []string{"*"},
- AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"},
- AllowCredentials: true,
- })
-
- h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })
-
- http.ListenAndServe(":8080", c.Handler(h))
-}
diff --git a/src/vendor/github.com/rs/cors/examples/xhandler/server.go b/src/vendor/github.com/rs/cors/examples/xhandler/server.go
deleted file mode 100644
index 649a1c7..0000000
--- a/src/vendor/github.com/rs/cors/examples/xhandler/server.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/rs/cors"
- "github.com/rs/xhandler"
- "golang.org/x/net/context"
-)
-
-func main() {
- c := xhandler.Chain{}
-
- // Use default options
- c.UseC(cors.Default().HandlerC)
-
- mux := http.NewServeMux()
- mux.Handle("/", c.Handler(xhandler.HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"hello\": \"world\"}"))
- })))
-
- http.ListenAndServe(":8080", mux)
-}