示例#1
0
func InitMiddleware(m *martini.ClassicMartini) {
	c := cors.New(cors.Options{
		AllowedOrigins: []string{"*"},
	})
	m.Handlers(PARAMS,
		DB(),
		sessions.Sessions("lol_session", sessions.NewCookieStore([]byte("secret123"))),
		oauth2.Facebook(
			&goauth2.Config{
				ClientID:     ClientId,
				ClientSecret: ApiSecret,
				Scopes:       []string{"public_profile", "email", "user_friends"},
				RedirectURL:  "http://www.lol-at-pitt.com/oauth2callback",
			},
		),
		c.HandlerFunc,
		render.Renderer(render.Options{Directory: TemplatesLocation}),
		martini.Static("resources/public", martini.StaticOptions{Prefix: "/public"}),
	)
}