Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

apisite/gin-mulate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gin-mulate

gin bindings for mulate package

GoCard GitHub Release GitHub code size in bytes GitHub license

Differences from mulate:

  • gin support
  • URL params support (via gin)

Usage

    mlt, _ := mulate.New(cfg.Template)

    allFuncs := make(template.FuncMap, 0)
    err = mlt.LoadTemplates(allFuncs)
    if err != nil {
        log.Fatal(err)
    }

    router := gin.Default()
    templates := ginmulate.New(mlt, log)
    templates.Route("", router)
    router.Run(cfg.Addr)

URL params support

in file tmpl/page/my/:id/hello.tmpl:

{{ $id := param "id" }}

Request argument support

if request has argument id (?id=XX) it's value available via

{{ $id := .Request.URL.Query.Get "id" }}

See also

TODO

  • docs, part 1
  • tests, part 1
  • google and ask reddit for analogs
  • tests, part 2
  • docs, part 2
  • release

Similar projects

License

The MIT License (MIT), see LICENSE.

Copyright (c) 2018 Aleksei Kovrizhkin lekovr+apisite@gmail.com

About

gin bindings for mulate golang package

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages