Exemplo n.º 1
0
func _registerRestControllers() {

	framework.SetFactory("controllers.UserController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return rest.NewUserController(service)
	})

	framework.SetFactory("controllers.EventController", func() interface{} {
		service := framework.GetFactory("services.EventService").(services.EventService)
		return rest.NewEventController(service)
	})
}
Exemplo n.º 2
0
func _registerAuthControllers() {

	framework.SetFactory("controllers.GoogleController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return auth.NewGoogleController(service)
	})

	framework.SetFactory("controllers.FacebookController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return auth.NewFacebookController(service)
	})
}
Exemplo n.º 3
0
func _registerAuthRoutes(server framework.WebServer) {

	var google = framework.GetFactory("controllers.GoogleController").(*auth.GoogleController)
	var facebook = framework.GetFactory("controllers.FacebookController").(*auth.FacebookController)

	server.Get("/", google.HandleRoot)

	server.Get("/load", google.TestHighLoad)

	server.Post("/auth/facebook", facebook.Auth)
	server.Get("/auth/facebook/callback", facebook.AuthCallback)

	server.Post("/auth/google", google.Auth)
	server.Get("/auth/google/callback", google.AuthCallback)
}
Exemplo n.º 4
0
func _registerRestRoutes(server framework.WebServer) {

	userController := framework.GetFactory("controllers.UserController").(*rest.UserController)

	//user routes
	server.Get("/users", userController.ListUsers)
	server.Get("/user", userController.GetUser)
	server.Post("/user", userController.CreateUser)

	server.Get("/who", userController.Who)

	//event routes
	eventController := framework.GetFactory("controllers.EventController").(*rest.EventController)

	server.Get("/test", eventController.Test)
}
Exemplo n.º 5
0
func _registerServices() {
	framework.SetFactory("services.UserService", func() interface{} {

		repository := framework.GetFactory("repositories.UserRepository").(repositories.UserRepository)
		return servicesimpl.NewUserService(repository)
	})

	framework.SetFactory("services.EventService", func() interface{} {

		repository := framework.GetFactory("repositories.EventRepository").(repositories.EventRepository)
		return servicesimpl.NewEventService(repository)
	})

	framework.SetFactory("services.SessionService", func() interface{} {

		repository := framework.GetFactory("repositories.SessionRepository").(repositories.SessionRepository)
		return servicesimpl.NewSessionService(repository)
	})
}
Exemplo n.º 6
0
func _createHttpServer() framework.WebServer {
	httpCfg := &web.HttpConfig{}
	framework.Config.ReadInto("http", &httpCfg)

	sessionCfg := &web.SessionConfig{}
	framework.Config.ReadInto("session", &sessionCfg)

	securityCfg := &web.SecurityKeys{}
	framework.Config.ReadInto("security", &securityCfg)
	//TODO: setting public properties is not cool.. should be automatically set from the config file
	securityCfg.RawSignKey = []byte(securityCfg.SignKey)
	securityCfg.RawEncryptionKey = []byte(securityCfg.EncryptionKey)

	webCfg := &web.WebConfig{Http: httpCfg, Session: sessionCfg, Security: securityCfg}

	sessionService := framework.GetFactory("services.SessionService").(services.SessionService)

	return web.NewWebServer(webCfg, sessionService)
}