change MoneroNode and MoneroNodes handler name

MoneroNode -> Node
MoneroNodes -> Nodes
This commit is contained in:
ditatompel 2024-06-03 14:17:51 +07:00
parent 9323e63405
commit e01c28d966
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
2 changed files with 10 additions and 4 deletions

View file

@ -7,7 +7,8 @@ import (
"github.com/gofiber/fiber/v2"
)
func MoneroNode(c *fiber.Ctx) error {
// Returns a single node information based on `id` query param
func Node(c *fiber.Ctx) error {
nodeId, err := c.ParamsInt("id", 0)
if err != nil {
return c.Status(fiber.StatusUnprocessableEntity).JSON(fiber.Map{
@ -42,7 +43,8 @@ func MoneroNode(c *fiber.Ctx) error {
})
}
func MoneroNodes(c *fiber.Ctx) error {
// Returns a list of nodes
func Nodes(c *fiber.Ctx) error {
moneroRepo := monero.New()
query := monero.QueryNodes{
RowsPerPage: c.QueryInt("limit", 10),

View file

@ -4,15 +4,19 @@ import (
"github.com/gofiber/fiber/v2"
)
// V1 API routes
func V1Api(app *fiber.App) {
v1 := app.Group("/api/v1")
v1.Get("/nodes", MoneroNodes)
// these routes are public, they don't require a prober api key
v1.Get("/nodes", Nodes)
v1.Post("/nodes", AddNode)
v1.Get("/nodes/id/:id", MoneroNode)
v1.Get("/nodes/id/:id", Node)
v1.Get("/nodes/logs", ProbeLogs)
v1.Get("/fees", NetFees)
v1.Get("/countries", Countries)
// these routes are for prober, they require a prober api key
v1.Get("/job", CheckProber, GiveJob)
v1.Post("/job", CheckProber, ProcessJob)
}