add logging handler for all req's

This commit is contained in:
Danny van Kooten 2016-11-22 21:02:06 +01:00
parent 5f3e22665b
commit 2ff06c02d0
1 changed files with 3 additions and 6 deletions

9
ana.go
View File

@ -2,10 +2,11 @@ package main
import (
"net/http"
"os"
"github.com/dannyvankooten/ana/core"
"github.com/dannyvankooten/ana/api"
"github.com/gorilla/mux"
"github.com/gorilla/handlers"
)
// TODO: Authentication.
@ -25,9 +26,5 @@ func main() {
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.Handle("/", http.FileServer(http.Dir("./views/")))
// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// http.ServeFile(w, r, "./static/" + r.URL.Path[1:])
// })
http.ListenAndServe(":8080", r)
http.ListenAndServe(":8080", handlers.LoggingHandler(os.Stdout, r))
}