mirror of
https://github.com/spaytac/orbiter.git
synced 2026-01-22 14:34:42 +00:00
Add basic 404 page
This commit is contained in:
parent
4cdb55a18d
commit
3cea6bb8ba
14
api/notfound.go
Normal file
14
api/notfound.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NotFound struct{}
|
||||||
|
|
||||||
|
func (n NotFound) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(404)
|
||||||
|
logrus.Infof("%s %s not found.", r.Method, r.URL.String())
|
||||||
|
}
|
||||||
@ -12,5 +12,6 @@ func GetRouter(core core.Core, eventChannel chan *logrus.Entry) *mux.Router {
|
|||||||
r.HandleFunc("/autoscaler", AutoscalerList(core.Autoscalers)).Methods("GET")
|
r.HandleFunc("/autoscaler", AutoscalerList(core.Autoscalers)).Methods("GET")
|
||||||
r.HandleFunc("/health", Health()).Methods("GET")
|
r.HandleFunc("/health", Health()).Methods("GET")
|
||||||
r.HandleFunc("/events", Events(eventChannel)).Methods("GET")
|
r.HandleFunc("/events", Events(eventChannel)).Methods("GET")
|
||||||
|
r.NotFoundHandler = NotFound{}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user