Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 416 Bytes

.godocdown.md

File metadata and controls

24 lines (17 loc) · 416 Bytes

corset

A spec-compliant CORS middleware.

Setup

c := corset.NewCorset(corset.CorsetOptions{
  AllowedOrigins:   origins,
  AllowedMethods:   methods,
  AllowedHeaders:   headers,
  ExposeHeaders:    []string{"X-Powered-By"},
  AllowCredentials: true,
})

r := NewRouter() // implements `ServeHTTP`

if err := http.ListenAndServe(":3000", c.Handler(r)); err != nil {
  log.Fatal(err)
}

{{ .Emit }}