I am build a multi-subdomain HTTP service following the example using an host map
I would like to pass my datastore object into the context but the ServeHTTP func uses a newly-allocated one so it never goes down to my handler
Is there any work-around?
Should I use a global datastore object?
Thanks
// Server
e := echo.New()
e.Any("/*", func(c echo.Context) (err error) {
req := c.Request()
res := c.Response()
host := hosts[req.Host()]
if host == nil {
err = echo.ErrNotFound
} else {
c.Set("DataStore", persistence.DataStore) <-- HERE IS MY ISSUE
host.Echo.ServeHTTP(req, res)
}
return err
})
e.Run(standard.New(":8080"))
I am build a multi-subdomain HTTP service following the example using an host map
I would like to pass my datastore object into the context but the ServeHTTP func uses a newly-allocated one so it never goes down to my handler
Is there any work-around?
Should I use a global datastore object?
Thanks