Skip to content

Latest commit

 

History

History
61 lines (50 loc) · 1.36 KB

File metadata and controls

61 lines (50 loc) · 1.36 KB

Vingo

⚡️ What is Vingo?

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.


⚙️ Installation

go get github.com/coderianx/vingo

🚀 Quick Start

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)
}

Template Example (index.html)

<!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>

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.