Exemple #1
0
func main() {
	file, err := os.Open("config.json")
	if err != nil {
		panic(err)
	}
	app := golf.New()
	app.Get("/version", versionHandler)
	app.Get("/", homeHandler)
	app.Config, err = golf.ConfigFromJSON(file)
	app.Run(":9000")
}
Exemple #2
0
func main() {
	app := golf.New()
	app.Use(golf.XSRFProtectionMiddleware)
	app.View.SetTemplateLoader("default", ".")

	app.Get("/", mainHandler)
	app.Post("/login", loginHandlerPost)
	app.Get("/login", loginHandler)

	app.Run(":9000")
}
Exemple #3
0
func main() {
	app := golf.New()
	app.View.SetTemplateLoader("default", ".")
	app.SessionManager = golf.NewMemorySessionManager()
	app.Use(golf.SessionMiddleware)

	app.Get("/", mainHandler)
	app.Post("/login", loginHandlerPost)
	app.Get("/login", loginHandler)

	app.Run(":9000")
}