Skip to content

joonathan/gin-pongo2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gin-pongo2

pongo2 middleware for Gin framework.

##Example:

package main

import (
    "os"

    "github.com/gin-gonic/gin"
    "github.com/rainbowism/gin-pongo2"
)

func main() {
    switch os.Getenv("MODE") {
    case "RELEASE":
        gin.SetMode(gin.ReleaseMode)

    case "DEBUG":
        gin.SetMode(gin.DebugMode)

    case "TEST":
        gin.SetMode(gin.TestMode)

    default:
        gin.SetMode(gin.ReleaseMode)
    }

    router := gin.New()
    router.Use(gin.Recovery())

    if gin.IsDebugging() {
        router.HTMLRender = render.NewDebug("resources")
    } else {
        router.HTMLRender = render.NewProduction("resources")
    }

    router.Static("/static", "resources/static")
    router.GET("/", func(c *gin.Context) {
        c.HTML(http.StatusOK, "index.tpl", render.Context{"title": "Gin-pongo2!"})
    })

    router.Run(":3000")
}

About

pongo2 middleware for Gin framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.5%
  • Smarty 4.5%