R
R
reus2017-02-07 17:45:06
go
reus, 2017-02-07 17:45:06

golang. How to connect handler (Gin framework) to CloudyKit/jet template?

I have
package main code

import (
    	"net/http"
    
    	"github.com/CloudyKit/jet"
    	"github.com/gin-gonic/gin"
    )
    
    var views = jet.NewHTMLSet("./views")
    
    // var router *gin.Engine
    func main() {
    	router := gin.Default()
    	// router.Use(gin.Recovery())
    	router.LoadHTMLGlob("templates/*")
    	router.StaticFS("/static/", http.Dir("static"))
    	router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index.jet", gin.H{"title": "Home Page"}) })
    	router.Run("192.168.1.107:8001")
    }

how to connect the template now?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question