Skip to content

Commit

Permalink
feat: map version
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Jul 31, 2023
1 parent 61cafb4 commit 3d662dd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions server/map_versions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Returns an map of channel and versions of the dart sdk
*
* Endpoint: /versions/map
* Result: { body: map[string][]string }
*/

package server

import (
"github.com/Yakiyo/dinx/utils"
"github.com/gofiber/fiber/v2"
)

func init() {
App.Get("/versions/map", mapVersionsHandler)
}

func mapVersionsHandler(c *fiber.Ctx) error {
js, err := utils.ReadVersions("versions.json")
if err != nil {
return utils.Error(err.Error(), c)
}

return c.JSON(js)
}

0 comments on commit 3d662dd

Please sign in to comment.