Nexus/pkg/internal/http/api/directory.go

20 lines
444 B
Go
Raw Normal View History

2024-10-19 14:36:33 +00:00
package api
import (
2024-10-20 16:05:40 +00:00
directory2 "git.solsynth.dev/hypernet/nexus/pkg/internal/directory"
2024-10-19 14:36:33 +00:00
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
)
func listExistsService(c *fiber.Ctx) error {
2024-10-20 16:05:40 +00:00
services := directory2.ListServiceInstance()
2024-10-19 14:36:33 +00:00
2024-10-20 16:05:40 +00:00
return c.JSON(lo.Map(services, func(item *directory2.ServiceInstance, index int) map[string]any {
2024-10-19 14:36:33 +00:00
return map[string]any{
"id": item.ID,
"type": item.Type,
"label": item.Label,
}
}))
}