2024-03-14 19:24:41 +01:00
|
|
|
package webHandler
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"html/template"
|
|
|
|
|
"net/http"
|
2024-05-16 17:36:44 +02:00
|
|
|
"portfolio/types"
|
2024-03-14 19:24:41 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func InitProjectpage(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
tmpl := template.Must(template.ParseFiles("./templates/index.html"))
|
|
|
|
|
|
|
|
|
|
userNames := map[string][]types.Username{
|
|
|
|
|
"Names": {
|
|
|
|
|
{Name: "The Godfather"},
|
|
|
|
|
{Name: "Blade Runner"},
|
|
|
|
|
{Name: "The Thing"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err := tmpl.Execute(w, userNames)
|
|
|
|
|
if err != nil {
|
|
|
|
|
_, err := w.Write([]byte("failed to load"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|