tijl.dev-core/cmd/server/main.go

33 lines
627 B
Go
Raw Normal View History

2024-08-19 22:32:43 +02:00
package main
import (
"log"
"git.tijl.dev/tijl/tijl.dev/internal/assets"
"git.tijl.dev/tijl/tijl.dev/internal/i18n"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)
func main() {
assets.LoadSVGs()
i18n.LoadTranslations()
engine := html.New("/home/tijl/projects/tijldev-next/web", ".html")
engine.AddFunc("icon", assets.Svg)
engine.AddFunc("translate", i18n.TranslateFunc())
app := fiber.New(fiber.Config{
Views: engine,
})
app.Get("/", func(c *fiber.Ctx) error {
return c.Render("pages/index", fiber.Map{})
})
app.Static("/static", "./static")
log.Fatal(app.Listen(":3000"))
}