Vingo is a modern template engine developed under the Flint Framework. it provides a fast, flexible, and clean way to render templates in Golang,with full entegration into Flint.
go get github.com/coderianx/vingo
package main
import (
"net/http"
"github.com/coderianx/vingo"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
tmpl, err := vingo.Render("index.html", map[string]interface{}{
"title": "Welcome to Vingo",
"message": "Hello, Vingo!",
})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Write([]byte(html))
})
http.ListenAndServe(":8080", nil)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><{ title }></title>
</head>
<body>
<h1><{ message }></h1>
</body>
</html>
This project is licensed under the MIT License - see the LICENSE file for details.