2024-07-28 09:40:32 -05:00
|
|
|
package index
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"html/template"
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetIndex(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
tmpl, err := template.ParseGlob("view/*.html")
|
|
|
|
|
if err != nil {
|
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data := struct {
|
|
|
|
|
Message string
|
|
|
|
|
MainTitle string
|
|
|
|
|
}{
|
2024-07-28 10:59:38 -05:00
|
|
|
Message: "Hello World!!",
|
2024-07-28 09:40:32 -05:00
|
|
|
MainTitle: "SimpleWebsite!",
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-28 10:55:55 -05:00
|
|
|
tmpl.ExecuteTemplate(w, "index", data)
|
2024-07-28 09:40:32 -05:00
|
|
|
|
|
|
|
|
}
|