60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"html/template"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
type PageData struct {
|
|
CompanyName string
|
|
Title string
|
|
KVK string
|
|
Email string
|
|
Phone string
|
|
}
|
|
|
|
func main() {
|
|
// Parse templates
|
|
tmpl := template.Must(template.ParseGlob("templates/*.html"))
|
|
|
|
// Static files
|
|
fs := http.FileServer(http.Dir("static/"))
|
|
http.Handle("/static/", http.StripPrefix("/static/", fs))
|
|
|
|
// Home page
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
data := PageData{
|
|
CompanyName: "poepiescheet",
|
|
Title: "Linux Migratie Service - Uw Computer Nieuw Leven Geven",
|
|
KVK: "12345678", // Replace with actual KVK number
|
|
Email: "info@poepiescheet.nl",
|
|
Phone: "+31 6 12345678",
|
|
}
|
|
|
|
if err := tmpl.ExecuteTemplate(w, "index.html", data); err != nil {
|
|
log.Printf("Template execution error: %v", err)
|
|
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
|
}
|
|
})
|
|
|
|
// Contact page
|
|
http.HandleFunc("/contact", func(w http.ResponseWriter, r *http.Request) {
|
|
data := PageData{
|
|
CompanyName: "poepiescheet",
|
|
Title: "Contact - poepiescheet",
|
|
KVK: "12345678", // Replace with actual KVK number
|
|
Email: "info@poepiescheet.nl",
|
|
Phone: "+31 6 12345678",
|
|
}
|
|
|
|
if err := tmpl.ExecuteTemplate(w, "contact.html", data); err != nil {
|
|
log.Printf("Template execution error: %v", err)
|
|
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
|
}
|
|
})
|
|
|
|
log.Println("Server starting on :8080")
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|