Skip to content

paul-norman/go-template-manager-echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

templateManager Echo Integration

This is the package for the templateManager renderer integration for the Echo framework.

For all options, please see the main repository.

Basic Usage

package main

import (
	"net/http"

	TM "github.com/paul-norman/go-template-manager-echo"
	"github.com/labstack/echo/v4"
)

func main() {
	renderer := TM.Init("templates", ".html")
	renderer.ExcludeDirectories([]string{"layouts", "partials"}).
			Reload(true).
			Debug(true).
			Parse()
	
	e := echo.New()
	e.Renderer = renderer

	e.GET("/", func(c echo.Context) error {
		return c.Render(http.StatusOK, "home.html", TM.Params{
			"Title": "Home",
		})
	})

	e.GET("/test", func(c echo.Context) error {
		return c.Render(http.StatusOK, "test.html", TM.Params{
			"Title": "Test",
		})
	})

	e.Logger.Fatal(e.Start(":8080"))
}

About

TemplateManager Renderer Integration for the Echo framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages