使用/ rs / cors作为Buffalo固件的示例?

I'm trying to get the /rs/cors package to work with the latest Buffalo as Preware, which is supposed to work according to a recent blog post (https://blog.gobuffalo.io/buffalo-v0-9-4-released-5d2327a4742e), but the code snippet there doesn't seem to make sense. If I generate a new buffalo app as an API, and I look at adding the cors package, I start with:

app = buffalo.New(buffalo.Options{
    Env:          ENV,
    SessionStore: sessions.Null{},
    SessionName:  "_creatorhub_session",
})
// Automatically redirect to SSL
app.Use(ssl.ForceSSL(secure.Options{
    SSLRedirect:     ENV == "production",
    SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
}))

// Set the request content type to JSON
app.Use(middleware.SetContentType("application/json"))

I should obviously add something along the lines of "PreWares: []buffalo.PreWare{}," but it seems to want a HandlerFunc, which /rs/cors doesn't seem to return under normal use, so I'm failing to find the right combination to make these work properly together and I haven't found a working example.

Anyone out there have an example to share? Any ideas appreciated!

Finally figured it out, so I'll share the info here for anyone else. This is using Buffalo v0.10.1 and the https://github.com/rs/cors project. I dug in and found that I could set up the cors object with (using localhost for example):

    c := cors.New(cors.Options{
        AllowedOrigins:   []string{"http://localhost:8080"},
        AllowCredentials: true,
    })

and then add it into the Buffalo instantiation by getting the Handler out of it:

app = buffalo.New(buffalo.Options{
    Env:          ENV,
    SessionStore: sessions.Null{},
    SessionName:  "_creatorhub_session",
    PreWares:     []buffalo.PreWare{c.Handler},
})

That worked for me. The issue was that it was difficult to find documentation for what Buffalo wanted passed in to PreWare and matching it up with what could be provided by the cors package.

Hope this helps out someone else in the future!