示例#1
0
func setupDependencies() {
	r = pat.New()
	handlers.SetRouter(r)

	templateRenderer = templating.NewTemplateRenderer()
	shortcuts = &services.TemplatingShortcuts{templateRenderer}

	userRepository := repositories.NewUserRepository()

	f = &filters.Filters{shortcuts, userRepository}

	homeHandler = &handlers.HomeHandler{shortcuts, userRepository}
	loginHandler = &handlers.LoginHandler{shortcuts, userRepository}
	signupHandler = &handlers.SignupHandler{shortcuts, userRepository}
}
示例#2
0
func setupDependencies() {
	r = pat.New()
	handlers.SetRouter(r)

	userRepository := sqlrepositories.NewUserRepository()

	authenticator = &authentication.EmailAuthenticator{userRepository}
	sessionStore = &sessions.CookieSessionStore{}

	templateRenderer = templating.NewTemplateRenderer()
	shortcuts = handlers.Shortcuts{templateRenderer, sessionStore}

	f = &filters.Filters{shortcuts, sessionStore, userRepository}

	homeHandler = &handlers.HomeHandler{shortcuts, userRepository}
	loginHandler = &handlers.LoginHandler{shortcuts, authenticator, userRepository, sessionStore}
	signupHandler = &handlers.SignupHandler{shortcuts, userRepository}
}