|
|
@@ -14,19 +14,21 @@ func main() {
|
|
|
t := template.Must(template.ParseFiles("templates/main.html"))
|
|
|
s := server{template: t}
|
|
|
http.HandleFunc("/", s.handleRoot)
|
|
|
- http.Handle("/resource/", http.FileServer(http.Dir(".")))
|
|
|
- log.Fatal(http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil))
|
|
|
+ http.Handle("/resources/", http.FileServer(http.Dir(".")))
|
|
|
+ log.Println("Listening on https://localhost:8443")
|
|
|
+ err := http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil)
|
|
|
+ log.Fatal(err)
|
|
|
}
|
|
|
|
|
|
func (s *server) handleRoot(w http.ResponseWriter, r *http.Request) {
|
|
|
+ w.Header().Set("Content-Type", "text/html")
|
|
|
|
|
|
if r.RequestURI != "/" {
|
|
|
http.NotFound(w, r)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- w.Header().Set("Content-Type", "text/html")
|
|
|
- err := s.template.Execute(w, "Devoxx")
|
|
|
+ err := s.template.Execute(w, "Vrolijk pasen!")
|
|
|
|
|
|
if err != nil {
|
|
|
log.Println(err)
|