Skip to content

Commit

Permalink
serve to /dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
eumel8 committed Jan 13, 2025
1 parent 0807359 commit 3c29940
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ func main() {

log.GetFormatter().(*log.TextFormatter).SetTemplate(logTemplate)

http.Handle("/", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Handle("/dashboard", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Serve the HTML file
http.ServeFile(w, r, *indexTemplate)
})))

http.Handle("/api/query", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Handle("/dashboard/api/query", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query().Get("query")
if query == "" {
log.Error("Query parameter is required")
Expand All @@ -196,7 +196,7 @@ func main() {
json.NewEncoder(w).Encode(response)
})))

http.Handle("/api/alerts", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Handle("/dashboard/api/alerts", LoggingMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
alerts, err := queryAlertmanager()
if err != nil {
log.Errorf("Error querying Alertmanager: %v", err)
Expand Down

0 comments on commit 3c29940

Please sign in to comment.