Skip to content

Instantly share code, notes, and snippets.

@DiegoSantosWS
Created September 17, 2018 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiegoSantosWS/71b0e6fc15604626547dc73aaae8a194 to your computer and use it in GitHub Desktop.
Save DiegoSantosWS/71b0e6fc15604626547dc73aaae8a194 to your computer and use it in GitHub Desktop.
Carregando a index
package models
import (
"log"
"net/http"
ctr "github.com/DiegoSantosWS/gotoweb/example_html/renderHtml"
)
//IndexPage carrega template de index
func IndexPage(w http.ResponseWriter, r *http.Request) {
data := map[string]interface{}{
"Title": "My frist page using GOLANG",
"Agre": "My frist page using GOLANG",
}
if err := ctr.ModelosIndex.ExecuteTemplate(w, "index.html", data); err != nil {
http.Error(w, "[CONTENT ERRO] Erro in the execute template",
http.StatusInternalServerError)
log.Fatal(err.Error())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment