Exemple #1
0
func main() {

	session_store := sessions.NewCookieStore([]byte("A-Tonga-da-Mironga-do-Kabulete"))

	m := martini.Classic()

	fmt.Println("Environment: " + martini.Env)

	m.Use(sessions.Sessions("user_control", session_store))
	m.Use(render.Renderer())
	m.Use(core.Auth("user", "passwd"))

	m.Get("/", Index)
	m.Post("/login", Login)
	m.Get("/logout", Logout)
	m.Run()
}
Exemple #2
0
func main() {

	postsdb = Posts{Post{"Olá", "Prazer em conhecê-los!"}}

	session_store := sessions.NewCookieStore([]byte("A-Tonga-da-Mironga-do-Kabulete"))

	m := martini.Classic()

	fmt.Println("Environment: " + martini.Env)

	m.Use(sessions.Sessions("user_control", session_store))
	m.Use(render.Renderer())
	m.Use(core.Auth("user", "passwd"))

	m.Get("/posts", PostsHandler)
	m.Post("/post", PostHandler)
	m.Get("/register", RegisterHandler)
	m.Run()
}