brunel/handlers/packages/package.go

18 lines
353 B
Go

package handlers_packages
import (
"brunel/packages"
"github.com/gofiber/fiber/v2"
)
func Package(c *fiber.Ctx) error {
pkgName := c.Params("package")
packs := packages.GetPackages()
pack, ok := packs.Get(pkgName)
if !ok {
return c.Status(fiber.StatusNotFound).SendString("Package not found")
}
return c.Status(fiber.StatusOK).JSON(pack)
}