Skip to content
Snippets Groups Projects
Commit 544c7500 authored by ale's avatar ale
Browse files

Version the API endpoint path

parent 8782d568
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ func main() { ...@@ -25,7 +25,7 @@ func main() {
// Create the http.Server. // Create the http.Server.
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/ingest", collector) mux.Handle("/ingest/v1", collector)
server := &http.Server{ server := &http.Server{
Addr: *addr, Addr: *addr,
Handler: mux, Handler: mux,
......
...@@ -31,10 +31,6 @@ func NewCollector(sink Sink, handlers ...Handler) *Collector { ...@@ -31,10 +31,6 @@ func NewCollector(sink Sink, handlers ...Handler) *Collector {
} }
func (c *Collector) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (c *Collector) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(w, req)
return
}
if req.Method != http.MethodPost { if req.Method != http.MethodPost {
http.Error(w, "Bad method", http.StatusMethodNotAllowed) http.Error(w, "Bad method", http.StatusMethodNotAllowed)
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment