Exemple #1
0
// Configure setups routes and templates
func Configure(r *render.BufferedRender, e *echo.Echo) error {
	// Add templates
	err := r.Load("legal_document", utils.TmplAbs("legal_document.tmpl"), utils.TmplAbs("layouts", "black_base.tmpl"))
	if err != nil {
		return err
	}

	// Add routes
	e.Get("/legal/licenses/:slug", Licenses)
	e.Get("/legal/terms-of-uses/:slug", UseTerms)
	e.Get("/legal/privacy-policies/:slug", PrivacyPolicies)
	return nil
}
Exemple #2
0
// Configure setups routes and templates
func Configure(r *render.BufferedRender, e *echo.Echo) error {
	// Add templates
	err := r.Load("500", utils.TmplAbs("500.tmpl"), utils.TmplAbs("layouts", "black_base.tmpl"))
	if err != nil {
		return err
	}

	e.SetHTTPErrorHandler(HandleError)
	e.Get("/500", FailOnPropouse)

	// Add routes
	return nil
}
Exemple #3
0
// Configure setups routes and templates
func Configure(r *render.BufferedRender, e *echo.Echo) error {
	// Add templates
	err := r.Load("index", utils.TmplAbs("index.tmpl"), utils.TmplAbs("layouts", "blog.tmpl"))
	if err != nil {
		return err
	}

	err = r.Load("post", utils.TmplAbs("post.tmpl"), utils.TmplAbs("layouts", "blog.tmpl"))
	if err != nil {
		return err
	}

	err = r.Load("archive", utils.TmplAbs("archive.tmpl"), utils.TmplAbs("layouts", "blog.tmpl"))
	if err != nil {
		return err
	}

	err = r.Load("category", utils.TmplAbs("category.tmpl"), utils.TmplAbs("layouts", "blog.tmpl"))
	if err != nil {
		return err
	}

	err = r.Load("profile", utils.TmplAbs("profile.tmpl"), utils.TmplAbs("layouts", "red_base.tmpl"))
	if err != nil {
		return err
	}

	err = r.Load("contact", utils.TmplAbs("contact.tmpl"), utils.TmplAbs("layouts", "blog.tmpl"))
	if err != nil {
		return err
	}

	// Add routes
	e.Get("/", Index)
	e.Get("/posts/:id", PostView)
	e.Get("/categories/:id", CategoryView)
	e.Get("/archive/:id", ArchiveView)
	e.Get("/profiles/:id", ProfileView)
	e.Post("/posts/:id/comments", AddComment)
	e.Get("/contact", ContactView)
	e.Post("/contact", DoContact)
	return nil
}