A spec-compliant CORS middleware.
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 }}