Skip to content

Commit

Permalink
Solved router error
Browse files Browse the repository at this point in the history
  • Loading branch information
PreetinderSinghBadesha committed Jun 15, 2024
1 parent 73e8d3c commit 5a3d7b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func GetAllLinks(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("No links found"))
return
}
err := json.NewEncoder(w).Encode(links)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
var linksData []string
for _, link := range links {
// w.Write([]byte(fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link)))
linksData = append(linksData, fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link))
}
page.Execute(w, linksData)
}
Expand Down

0 comments on commit 5a3d7b2

Please sign in to comment.