// App is where all routes and middleware for buffalo
// should be defined. This is the nerve center of your
// application.
App is where all routes and middleware for buffalo
should be defined. This is the nerve center of your
application.
// App is where all routes and middleware for buffalo // should be defined . This is the nerve center of your // application .
func App() *buffalo.App {
	if app == nil {
		app = buffalo.New(buffalo.Options{
			Env:         ENV,
			SessionName: "_go_hackathon_starter_session",
		})
		app.Use(forcessl.Middleware(secure.Options{
			SSLRedirect:     ENV == "production",
			SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
		}))
		if ENV == "development" {
			app.Use(paramlogger.ParameterLogger)
		}
		app.Use(csrf.New)
		app.Use(popmw.Transaction(models.DB))
		var err error
		if T, err = i18n.New(packr.NewBox("../locales"), "en-US"); err != nil {
			app.Stop(err)
		}
		app.Use(T.Middleware())
		app.ServeFiles("/assets", render.AssetsBox)
		app.Use(SetCurrentUser)
		app.Use(Authorize)
		configureRoutes(app)
	}
	return app
}
func App ( ) * buffalo . App { if app == nil { app = buffalo . New ( buffalo . Options { Env : ENV , SessionName : " " , } ) app . Use ( forcessl . Middleware ( secure . Options { SSLRedirect : ENV == " " , SSLProxyHeaders : map [ string ] string { " " : " " } , } ) ) if ENV == " " { app . Use ( paramlogger . ParameterLogger ) } app . Use ( csrf . New ) app . Use ( popmw . Transaction ( models . DB ) ) var err error if T , err = i18n . New ( packr . NewBox ( " " ) , " " ) ; err != nil { app . Stop ( err ) } app . Use ( T . Middleware ( ) ) app . ServeFiles ( " " , render . AssetsBox ) app . Use ( SetCurrentUser ) app . Use ( Authorize ) configureRoutes ( app ) } return app }
App is where all routes and middleware for buffalo
should be defined.
App is where all routes and middleware for buffalo should be defined .
// Automatically redirect to SSL // Protect against CSRF attacks. https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF) // Remove to disable this. // Wraps each request in a transaction. //  c.Value("tx").(*pop.PopTransaction) // Remove to disable this. // Setup and use translations: