Skip to content

Commit cc45aa2

Browse files
author
Elisamuel Resto
committed
Order of URIs matters for Gin, so /spots wasn't working but /spots/20m was.
1 parent 4e87ef0 commit cc45aa2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

frontend/routes.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ type SpotCache interface {
2525

2626
// SetupRoutes configures all API endpoints
2727
func SetupRoutes(r *gin.RouterGroup, cache SpotCache, dxccClient *dxcc.Client, lotwClient *lotw.Client) {
28-
// GET /spots - Retrieve all cached spots.
29-
r.GET("/spots", func(c *gin.Context) {
30-
spots := cache.GetAllSpots()
31-
c.JSON(http.StatusOK, spots)
32-
})
33-
3428
// GET /spot/:qrg - Retrieve the latest spot for a given frequency (QRG).
3529
// Supports: Hz (14250000), kHz (14250), MHz (14.250)
3630
r.GET("/spot/:qrg", func(c *gin.Context) {
@@ -67,6 +61,12 @@ func SetupRoutes(r *gin.RouterGroup, cache SpotCache, dxccClient *dxcc.Client, l
6761
}
6862
})
6963

64+
// GET /spots - Retrieve all cached spots.
65+
r.GET("/spots", func(c *gin.Context) {
66+
spots := cache.GetAllSpots()
67+
c.JSON(http.StatusOK, spots)
68+
})
69+
7070
// GET /spots/:band - Retrieve all cached spots for a given band.
7171
r.GET("/spots/:band", func(c *gin.Context) {
7272
bandParam := strings.ToLower(c.Param("band"))

0 commit comments

Comments
 (0)