feat: Added robots.txt route

This commit is contained in:
Christian Ditaputratama 2024-11-07 00:59:57 +07:00
parent 5a22a0b71f
commit c1c72274cf
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
2 changed files with 6 additions and 0 deletions

View file

@ -26,6 +26,11 @@ func (s *fiberServer) redirectLogs(c *fiber.Ctx) error {
return c.Redirect(fmt.Sprintf("/remote-nodes/id/%d", id), fiber.StatusMovedPermanently)
}
// Render robots.txt
func (s *fiberServer) robotsTxtHandler(c *fiber.Ctx) error {
return c.SendString("User-agent: *\nAllow: /\n")
}
// Render Home Page
func (s *fiberServer) homeHandler(c *fiber.Ctx) error {
p := views.Meta{

View file

@ -2,6 +2,7 @@ package handler
func (s *fiberServer) Routes() {
s.App.Get("/", s.homeHandler)
s.App.Get("/robots.txt", s.robotsTxtHandler)
s.App.Get("/remote-nodes", s.remoteNodesHandler)
s.App.Get("/remote-nodes/id/:id", s.nodeHandler)
s.App.Get("/add-node", s.addNodeHandler)