package main
import (
"fmt"
"net/http"
"text/template"
)
type PageVariables struct {
Title string
}
func main() {
http.HandleFunc("/", HomePage)
http.ListenAndServe(":8080", nil)
}
func HomePage(w http.ResponseWriter, r *http.Request) {
pageVariables := PageVariables{
Title: "Home Page",
}
tmpl, err := template.New("index").Parse(`
<!DOCTYPE html>
<html>
<head>
<title>{{.Title}}</title>
<style>
/ Add your Bootstrap styles here /
/ Custom styles for hiding the placeholder on focus /
input:focus::placeholder {
visibility: hidden;
}
</style>
</head>
<body>
<!-- Your HTML content goes here -->
<input type="text" placeholder="Enter text here">
</body>
</html>
`)
if err != nil {
fmt.Println("Error creating template:", err)
return
}
tmpl.Execute(w, pageVariables)
}