Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ENV = envy.Get("GO_ENV", "development")
ENV is used to help switch settings based on where the application is being run. Default is "development".
var GormTransaction = func(db *gorm.DB) buffalo.MiddlewareFunc { return func(h buffalo.Handler) buffalo.Handler { return func(c buffalo.Context) error { ef := func() error { if err := h(c); err != nil { return err } if res, ok := c.Response().(*buffalo.Response); ok { if res.Status < 200 || res.Status >= 400 { return errors.New("no connection to db") } } return nil } tx := db.Begin() if tx.Error != nil { return errors.WithStack(tx.Error) } defer tx.Commit() c.Set("tx", tx) err := ef() if err != nil && errors.Cause(err) != errors.New("no connection to db") { tx.Rollback() return err } return nil } } }
var T *i18n.Translator
Functions ¶
func App ¶
App is where all routes and middleware for buffalo should be defined. This is the nerve center of your application.
Routing, middleware, groups, etc... are declared TOP -> DOWN. This means if you add a middleware to `app` *after* declaring a group, that group will NOT have that new middleware. The same is true of resource declarations as well.
It also means that routes are checked in the order they are declared. `ServeFiles` is a CATCH-ALL route, so it should always be placed last in the route declarations, as it will prevent routes declared after it to never be called.
Types ¶
This section is empty.