github.com/lenfree/buffalo@v0.7.3-0.20170207163156-891616ea4064/examples/hello-world/actions/app.go (about) 1 package actions 2 3 import ( 4 "os" 5 6 "github.com/gobuffalo/buffalo" 7 "github.com/markbates/going/defaults" 8 ) 9 10 // ENV is used to help switch settings based on where the 11 // application is being run. Default is "development". 12 var ENV = defaults.String(os.Getenv("GO_ENV"), "development") 13 var app *buffalo.App 14 15 // App is where all routes and middleware for buffalo 16 // should be defined. This is the nerve center of your 17 // application. 18 func App() *buffalo.App { 19 if app == nil { 20 app = buffalo.Automatic(buffalo.Options{ 21 Env: ENV, 22 }) 23 24 app.ServeFiles("/assets", assetsPath()) 25 app.GET("/", HomeHandler) 26 } 27 28 return app 29 }