123456789101112131415161718192021222324252627 |
- package main
- import (
- "html/template"
- "log"
- "net/http"
- )
- var templates *template.Template
- type usuario struct {
- Nome string
- Email string
- }
- func main() {
- u := usuario{"Fernando Paschoeto", "fernandopaschoeto@gmail.com"}
- templates = template.Must(template.ParseGlob("*.html"))
- http.HandleFunc("/home", func(w http.ResponseWriter, r *http.Request) {
- templates.ExecuteTemplate(w, "index.html", u)
- })
- log.Fatal(http.ListenAndServe(":5000", nil))
- }
|