Permalink
Browse files

Moving Example into seperate package so code matches.

  • Loading branch information...
Jamie Stackhouse
Jamie Stackhouse committed Mar 29, 2015
1 parent 946cdb1 commit 86d0ea77e95a5d9515c0a59f98d3a06a29826587
Showing with 26 additions and 0 deletions.
  1. +26 −0 example_test.go
View
@@ -0,0 +1,26 @@
package cors_test
import (
"time"
"github.com/gin-gonic/gin"
"github.com/itsjamie/gin-cors"
)
func ExampleMiddleware() {
// Initialize the gin-gonic router
router := gin.New()
// Set up CORS middleware options
config := cors.Config{
Origins: "*",
RequestHeaders: "Authorization",
Methods: "GET, POST, PUT",
Credentials: true,
ValidateHeaders: false,
MaxAge: 1 * time.Minute,
}
// Apply the middleware to the router (works on groups too)
router.Use(cors.Middleware(config))
}

0 comments on commit 86d0ea7

Please sign in to comment.