Skip to content
Snippets Groups Projects
Verified Commit bb26e726 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Minimal functionality

parent 4b8ad6e6
Branches
No related tags found
No related merge requests found
...@@ -57,10 +57,6 @@ func main() { ...@@ -57,10 +57,6 @@ func main() {
panic(err) panic(err)
} }
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
})
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, channel := path.Split(r.URL.Path) _, channel := path.Split(r.URL.Path)
channelData := ChannelData{} channelData := ChannelData{}
...@@ -68,4 +64,13 @@ func main() { ...@@ -68,4 +64,13 @@ func main() {
db.QueryRow("SELECT SUM(characters), SUM(words) FROM messages WHERE channel = $1").Scan(&channelData.TotalCharacters, &channelData.TotalWords) db.QueryRow("SELECT SUM(characters), SUM(words) FROM messages WHERE channel = $1").Scan(&channelData.TotalCharacters, &channelData.TotalWords)
formatTemplate(w, "statistics", channelData) formatTemplate(w, "statistics", channelData)
}) })
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
})
err = http.ListenAndServe(":8080", nil)
if err != nil {
panic(err)
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment