gofiber/template

๐Ÿค— [Question]: Is it possible to use django/v3 on gofiber/v3.0.0-beta?

Opened this issue ยท 9 comments

Question Description

I've tried using django/v3 on gofiber/v3 but can't get past '{{ xxx }}' to get the arguments. is there a problem with my code?

Code Snippet (optional)

package main

import (
	// "github.com/gofiber/fiber/v2" // he worked very well.
	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/template/django/v3"
)

func main() {
	engine := django.New("views", ".html")
	engine.SetAutoEscape(false)
	app := fiber.New(fiber.Config{
		Views: engine,
	})
        // app.Get("/", func(ctx *fiber.Ctx) error { // gofiber/v2
	app.Get("/", func(ctx fiber.Ctx) error {
		return ctx.Render("index", fiber.Map{
			"Title":   "test title",
			"Content": "test content",
		})
	})
	app.Listen(":7200")
}

// views/index.html
// 
// <!DOCTYPE html>
// <html lang="en">
// <head>
//    <title>{{ Title }}</title>
// </head>
// 
// <body>
// <div>
//     {{ Content }}
// </div>
// </body>
// </html>

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.

I've used the gofiber/v3 for production

@var-rain confirm this works with v2 but not main/v3?

@var-rain confirm this works with v2 but not main/v3?

Yes, the same code I tried several times between v2 and v3, when using {{ Content }} to get data in v2 it works fine, but in v3 you get a blank page

@var-rain confirm this works with v2 but not main/v3?

look this โ†“โ†“โ†“โ†“โ†“
simple_test_v3
simple_test_v2

gaby commented

@var-rain The middlewares haven't been migrated/Tested with Fiber V3

@var-rain The middlewares haven't been migrated/Tested with Fiber V3

Ok, thanks, I thought django/v3 was the counterpart to gofiber/v3.

gaby commented

@var-rain That's the version for the django template. It's in the todo list to migrate these to GoFiber v3

@var-rain That's the version for the django template. It's in the todo list to migrate these to GoFiber v3

I've tried html (html/template) before this and it works on v3, so...

gaby commented

Lets re-open this then