xmr-remote-nodes/internal/handler/routes.go
Christian Ditaputratama b68f626ce2
refactor!: Use function method for routes
Will be useful for future development using standard `net/http`.
2024-11-06 22:15:53 +07:00

28 lines
1 KiB
Go

package handler
func (s *fiberServer) Routes() {
s.App.Get("/", s.homeHandler)
s.App.Get("/remote-nodes", s.remoteNodesHandler)
s.App.Get("/remote-nodes/id/:id", s.nodeHandler)
s.App.Get("/add-node", s.addNodeHandler)
s.App.Put("/add-node", s.addNodeHandler)
// This is temporary route to redirect old path to new one. Once search
// engine results updated to the new path, this route should be removed.
s.App.Get("/remote-nodes/logs", s.redirectLogs)
// V1 API routes
v1 := s.App.Group("/api/v1")
// these routes are public, they don't require a prober api key
v1.Get("/nodes", s.nodesAPI)
v1.Post("/nodes", s.addNodeAPI) // old add node form action endpoint. Deprecated: Use PUT /add-node instead
v1.Get("/nodes/id/:id", s.nodeAPI)
v1.Get("/nodes/logs", s.probeLogsAPI)
v1.Get("/fees", s.netFeesAPI)
v1.Get("/countries", s.countriesAPI)
// these routes are for prober, they require a prober api key
v1.Get("/job", s.checkProberMW, s.giveJobAPI)
v1.Post("/job", s.checkProberMW, s.processJobAPI)
}