Beispiel #1
0
func main() {
	mvcI := mvc.NewMvcInfrastructure()
	err := mvcI.ParseViewsFolder("templates")
	if err != nil {
		panic(err)
	}

	mvcI.BindController(NewHomeController)
	mvcI.BindUrl(names.C.Home, names.A.Home.Index, "/")

	http.Handle("/", mvcI.Router)
	err = http.ListenAndServe(":8000", nil)
	if err != nil {
		panic(err)
	}
}
Beispiel #2
0
func main() {
	mvcI := mvc.NewMvcInfrastructure()
	err := mvcI.ParseViewsFolder("templates")
	if err != nil {
		panic(err)
	}

	mvcI.BindController(NewHomeController)
	mvcI.BindUrl("home", "index", "/")
	// NB: all url to static content should begin with '/static/'
	mvcI.ServeStatic("/static/", "./static/")

	http.Handle("/", mvcI.Router)
	err = http.ListenAndServe(":8000", nil)
	if err != nil {
		panic(err)
	}
}
Beispiel #3
0
func main() {
	mvcI := mvc.NewMvcInfrastructure()
	err := mvcI.ParseViewsFolder("templates")
	if err != nil {
		panic(err)
	}

	mvcI.SetNotFoundView(&mvc.ControllerAction{names.C.Shared, names.V.Shared.NotFound404})
	mvcI.SetInternalErrorView(&mvc.ControllerAction{names.C.Shared, names.V.Shared.Error})

	mvcI.BindController(NewHomeController)
	mvcI.BindUrl(names.C.Home, names.A.Home.Index, "/")

	http.Handle("/", mvcI.Router)
	err = http.ListenAndServe(":8000", nil)
	if err != nil {
		panic(err)
	}
}