You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
505 B
Go
27 lines
505 B
Go
package routes
|
|
|
|
import (
|
|
"path"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
"github.com/gofiber/fiber/v2/middleware/logger"
|
|
"github.com/gofiber/fiber/v2/middleware/recover"
|
|
)
|
|
|
|
const FrontendOutDir = "./out/frontend"
|
|
|
|
func (s *Service) Root(r fiber.Router) {
|
|
|
|
r.Use(logger.New())
|
|
r.Use(recover.New())
|
|
|
|
r.Static("/", FrontendOutDir)
|
|
|
|
for _, entrypoint := range HtmlEntrypoints {
|
|
r.Get(entrypoint.Route, func(c *fiber.Ctx) error {
|
|
return c.SendFile(path.Join(FrontendOutDir, entrypoint.Filename))
|
|
})
|
|
}
|
|
|
|
}
|