2024-03-13 15:54:09 +01:00
|
|
|
package webHandler
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"html/template"
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func InitHomepage(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
2024-03-14 19:24:41 +01:00
|
|
|
tmpl := template.Must(template.ParseFiles(
|
|
|
|
|
"./templates/homepage/index.html",
|
|
|
|
|
"./templates/navbar/index.html",
|
|
|
|
|
))
|
2024-03-13 15:54:09 +01:00
|
|
|
|
2024-03-14 19:24:41 +01:00
|
|
|
err := tmpl.Execute(w, nil)
|
|
|
|
|
if err != nil {
|
|
|
|
|
_, err := w.Write([]byte("failed to load"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
return
|
2024-03-13 15:54:09 +01:00
|
|
|
}
|
2024-03-14 19:24:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
tmpl := template.Must(template.ParseFiles(
|
|
|
|
|
"./templates/homepage/index.html",
|
|
|
|
|
"./templates/navbar/index.html",
|
|
|
|
|
))
|
2024-03-13 15:54:09 +01:00
|
|
|
|
2024-03-14 19:24:41 +01:00
|
|
|
err := tmpl.Execute(w, nil)
|
2024-03-13 15:54:09 +01:00
|
|
|
if err != nil {
|
|
|
|
|
_, err := w.Write([]byte("failed to load"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|