This commit is contained in:
Felix Geisendörfer 2013-03-17 16:23:12 +01:00
parent 798e9fd8ab
commit 6e9a8c2b5e
1 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import (
)
func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
log.Printf("tusd started")
http.HandleFunc("/", route)
@ -21,14 +22,15 @@ func main() {
}
func route(w http.ResponseWriter, r *http.Request) {
log.Printf("%s %s", r.Method, r.URL.RequestURI())
w.Header().Set("Server", "tusd")
if r.Method == "POST" && r.URL.Path == "/files" {
if r.Method == "request: POST" && r.URL.Path == "/files" {
createFile(w, r)
return
} else {
reply(w, http.StatusNotFound, "No matching route")
}
reply(w, http.StatusNotFound, "No matching route")
}
func reply(w http.ResponseWriter, code int, message string) {