// 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.
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.
// 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 .
func App() *buffalo.App {
	if app == nil {
		buffaloAppOptions := buffalo.NewOptions()
		buffaloAppOptions.Name = "ROAW 2020"
		buffaloAppOptions.SessionName = "_roaw2020_session"
		app = buffalo.New(buffaloAppOptions)
		app.Use(forceSSL())
		app.Use(paramlogger.ParameterLogger)
		app.Use(csrf.New)
		app.Use(popmw.Transaction(models.DB))
		app.Use(translations())
		app.Use(SetCurrentUser)
		app.GET("/", DashboardHandler)
		auth := app.Group("/auth")
		authLogout := auth.Group("/logout")
		authLogout.GET("", AuthDestroy)
		auth.GET("/{provider}", buffalo.WrapHandlerFunc(gothic.BeginAuthHandler))
		auth.GET("/{provider}/callback", AuthCallback)
		activities := app.Group("/activities")
		activities.GET("/sync-all", SyncAllActivitiesHandler)
		activities.GET("/sync", SyncLastActivitiesHandler)
		users := app.Group("/users")
		users.Use(Authorize)
		users.GET("", ListUsersHandler)
		users.GET("/{user_id}", ShowUsersHandler)
		users.GET("/{user_id}/activities", ListUserActivitiesHandler)
		users.GET("/{user_id}/sync", SyncUserLatestActivitiesHandler)
		users.GET("/{user_id}/sync-all", SyncUserAllActivitiesHandler)
		dashboard := app.Group("/dashboard")
		dashboard.GET("", DashboardHandler)
		dashboard.GET("/other-tops", DashboardOtherTopsHandler)
		dashboardWeekly := dashboard.Group("/weekly")
		dashboardWeekly.GET("/distances", WeeklyDistanceStatsHandler)
		dashboardWeekly.GET("/cumulative-distances", WeeklyCumulativeDistanceStatsHandler)
		dashboardWeekly.GET("/counts", WeeklyCountStatsHandler)
		dashboardWeekly.GET("/cumulative-counts", WeeklyCumulativeCountStatsHandler)
		dashboardWeekly.GET("/duration", WeeklyDistanceStatsHandler)
		app.ServeFiles("/", assetsBox) 
	}
	return app
}
func App ( ) * buffalo . App { if app == nil { buffaloAppOptions := buffalo . NewOptions ( ) buffaloAppOptions . Name = " " buffaloAppOptions . SessionName = " " app = buffalo . New ( buffaloAppOptions ) app . Use ( forceSSL ( ) ) app . Use ( paramlogger . ParameterLogger ) app . Use ( csrf . New ) app . Use ( popmw . Transaction ( models . DB ) ) app . Use ( translations ( ) ) app . Use ( SetCurrentUser ) app . GET ( " " , DashboardHandler ) auth := app . Group ( " " ) authLogout := auth . Group ( " " ) authLogout . GET ( " " , AuthDestroy ) auth . GET ( " " , buffalo . WrapHandlerFunc ( gothic . BeginAuthHandler ) ) auth . GET ( " " , AuthCallback ) activities := app . Group ( " " ) activities . GET ( " " , SyncAllActivitiesHandler ) activities . GET ( " " , SyncLastActivitiesHandler ) users := app . Group ( " " ) users . Use ( Authorize ) users . GET ( " " , ListUsersHandler ) users . GET ( " " , ShowUsersHandler ) users . GET ( " " , ListUserActivitiesHandler ) users . GET ( " " , SyncUserLatestActivitiesHandler ) users . GET ( " " , SyncUserAllActivitiesHandler ) dashboard := app . Group ( " " ) dashboard . GET ( " " , DashboardHandler ) dashboard . GET ( " " , DashboardOtherTopsHandler ) dashboardWeekly := dashboard . Group ( " " ) dashboardWeekly . GET ( " " , WeeklyDistanceStatsHandler ) dashboardWeekly . GET ( " " , WeeklyCumulativeDistanceStatsHandler ) dashboardWeekly . GET ( " " , WeeklyCountStatsHandler ) dashboardWeekly . GET ( " " , WeeklyCumulativeCountStatsHandler ) dashboardWeekly . GET ( " " , WeeklyDistanceStatsHandler ) app . ServeFiles ( " " , assetsBox ) } 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 // Log request parameters (filters apply). // 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.Connection) // Remove to disable this. // Setup and use translations: // Setup Authorization // app.GET("/", HomeHandler) // /auth/ endpoints // users.DELETE("/{user_id}", DeleteUsersHandler) // serve files from the public directory