simplify routing, rm addremove.go

will implement a full rest API later
This commit is contained in:
Jimmy Zelinskie 2013-12-05 20:24:54 -05:00
parent fe1a4a6a65
commit 2b7d5b5bf0
2 changed files with 3 additions and 29 deletions

View file

@ -1,17 +0,0 @@
// Copyright 2013 The Chihaya Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package server
import (
"net/http"
)
func (s Server) serveAdd(w http.ResponseWriter, r *http.Request) {
return
}
func (s Server) serveRemove(w http.ResponseWriter, r *http.Request) {
return
}

View file

@ -83,18 +83,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer atomic.AddInt64(&s.deltaRequests, 1) defer atomic.AddInt64(&s.deltaRequests, 1)
r.Close = true r.Close = true
switch r.URL.Path {
case "/stats":
s.serveStats(w, r)
return
case "/add":
s.serveAdd(w, r)
return
case "/remove":
s.serveRemove(w, r)
return
}
_, action := path.Split(r.URL.Path) _, action := path.Split(r.URL.Path)
switch action { switch action {
case "announce": case "announce":
@ -103,6 +91,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case "scrape": case "scrape":
s.serveScrape(w, r) s.serveScrape(w, r)
return return
case "stats":
s.serveStats(w, r)
return
default: default:
fail(errors.New("Unknown action"), w, r) fail(errors.New("Unknown action"), w, r)
return return