()
| 42 | } |
| 43 | |
| 44 | func NewServer() *http.ServeMux { |
| 45 | mux := http.NewServeMux() |
| 46 | mux.HandleFunc("POST /api/submit", handleSubmit) |
| 47 | mux.HandleFunc("GET /api/packages", handlePackages) |
| 48 | mux.HandleFunc("GET /api/packages/{package}", handlePackage) |
| 49 | return mux |
| 50 | } |
| 51 | |
| 52 | func handleSubmit(w http.ResponseWriter, r *http.Request) { |
| 53 | if r.Header.Get("User-Agent") != build.UserAgent { |