diff --git a/app.go b/app.go index 2eef2bd..8ff4378 100644 --- a/app.go +++ b/app.go @@ -1,13 +1,25 @@ package main -import "github.com/gofiber/fiber/v2" +import ( + "github.com/gofiber/fiber/v2" + "github.com/gofiber/template/html/v2" +) func main() { - app := fiber.New() + app := fiber.New(fiber.Config{ + Views: setupTemplates(), + }) + + app.Static("/public", "./public") app.Get("/", func(ctx *fiber.Ctx) error { - return ctx.SendString("Privacy6") + return ctx.Render("index", fiber.Map{}) }) app.Listen("localhost:4200") } + +func setupTemplates() *html.Engine { + engine := html.New("./views", ".html") + return engine +} diff --git a/go.mod b/go.mod index 7dc1c56..1c15876 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,15 @@ module dc09.ru/privacyhex go 1.21.2 -require github.com/gofiber/fiber/v2 v2.49.2 +require ( + github.com/gofiber/fiber/v2 v2.49.2 + github.com/gofiber/template/html/v2 v2.0.5 +) require ( github.com/andybalholm/brotli v1.0.5 // indirect + github.com/gofiber/template v1.8.2 // indirect + github.com/gofiber/utils v1.1.0 // indirect github.com/google/uuid v1.3.1 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect diff --git a/go.sum b/go.sum index a3057e4..fec4541 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,12 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/gofiber/fiber/v2 v2.49.2 h1:ONEN3/Vc+dUCxxDgZZwpqvhISgHqb+bu+isBiEyKEQs= github.com/gofiber/fiber/v2 v2.49.2/go.mod h1:gNsKnyrmfEWFpJxQAV0qvW6l70K1dZGno12oLtukcts= +github.com/gofiber/template v1.8.2 h1:PIv9s/7Uq6m+Fm2MDNd20pAFFKt5wWs7ZBd8iV9pWwk= +github.com/gofiber/template v1.8.2/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= +github.com/gofiber/template/html/v2 v2.0.5 h1:BKLJ6Qr940NjntbGmpO3zVa4nFNGDCi/IfUiDB9OC20= +github.com/gofiber/template/html/v2 v2.0.5/go.mod h1:RCF14eLeQDCSUPp0IGc2wbSSDv6yt+V54XB/+Unz+LM= +github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= +github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..5a8c95b --- /dev/null +++ b/views/index.html @@ -0,0 +1,26 @@ + + + + + + PrivacyHex + + +
+ +
+ + + +
+
+ +