bmallred vor 9 Jahren
Ursprung
Commit
a6bc2137d0
3 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 3 0
      handlers/default.go
  2. 1 1
      html/loop.html
  3. 2 1
      main.go

+ 3 - 0
handlers/default.go

@ -2,6 +2,7 @@ package handlers
2 2
3 3
import (
4 4
	"html/template"
5
	"log"
5 6
	"net/http"
6 7
)
7 8
@ -13,7 +14,9 @@ var (
13 14
)
14 15
15 16
func DefaultHandler(w http.ResponseWriter, r *http.Request) {
17
	log.Println("Serving template for the default handler")
16 18
	if err := templateLoop.Execute(w, nil); err != nil {
19
		log.Println(err)
17 20
		http.Error(w, err.Error(), http.StatusInternalServerError)
18 21
	}
19 22
}

+ 1 - 1
html/loop.html

@ -24,6 +24,6 @@
24 24
</head>
25 25
<body>
26 26
    {{ template "content" . }}
27
    {{ templates "scripts" . }}
27
    {{ template "scripts" . }}
28 28
</body>
29 29
</html>

+ 2 - 1
main.go

@ -14,7 +14,7 @@ const (
14 14
)
15 15
16 16
func main() {
17
	log.Print("Configuring environment...")
17
	log.Print("Configuring environment")
18 18
	time.Local = time.UTC
19 19
	ConfigureEnvironment()
20 20
@ -30,5 +30,6 @@ func main() {
30 30
	blog := r.PathPrefix("/{username}/blog").Subrouter()
31 31
	blog.Methods("GET").HandlerFunc(handlers.BlogHandler)
32 32
33
	log.Print("Serving content on ", address())
33 34
	log.Fatal(http.ListenAndServe(address(), nil))
34 35
}