-
-
Notifications
You must be signed in to change notification settings - Fork 582
Ability to set up pre-app handlers #609
Comments
See #610 for the PR for this. Once this PR is merged you'll be able to write the following in the development branch: func App() *buffalo.App {
if app == nil {
app = buffalo.Automatic(buffalo.Options{
Env: ENV,
SessionName: "_coke_session",
PreWares: []buffalo.PreWare{cors.Default().Handler},
})
app.Use(middleware.SessionSaver)
if ENV == "development" {
app.Use(middleware.ParameterLogger)
}
if ENV != "test" {
app.Use(csrf.Middleware)
}
app.Use(middleware.PopTransaction(models.DB))
app.GET("/", HomeHandler).Alias("/foo")
app.POST("/", HomeHandler)
app.ServeFiles("/assets", packr.NewBox("../public/assets"))
}
return app
} Using http://www.test-cors.org/#?client_method=GET&client_credentials=false&server_url=http%3A%2F%2Flvh.me%3A3000&server_enable=true&server_status=200&server_credentials=false&server_tabs=remote I'm able to test that the CORS library works. This feature will be released in |
FYI: This does enable CORS, but setting a header for the response a la |
@wiemann Same issue. Results with "http: multiple response.WriteHeader calls" when calling non GET methods. |
Trying to add CORS using 'github.com/rs/cors' as middleware but I am unable to get access to handlers through the middleware.
The text was updated successfully, but these errors were encountered: