Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 template engines #129

Closed
mauricionr opened this issue Feb 12, 2020 · 7 comments
Closed

🔥 template engines #129

mauricionr opened this issue Feb 12, 2020 · 7 comments

Comments

@mauricionr
Copy link

Is your feature request related to a problem?
No

Describe the solution you'd like
Template engines like in express
https://expressjs.com/en/guide/using-template-engines.html

Describe alternatives you've considered
No ideia

Additional context
Not only static files but also template engine to also support pass data to template and render it

@welcome
Copy link

welcome bot commented Feb 12, 2020

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!

@Fenny
Copy link
Member

Fenny commented Feb 13, 2020

@mauricionr, we just released v1.6.0

Template rendering now our no.1 priority 👍, I will keep this issue open until we got more updates.

@Fenny
Copy link
Member

Fenny commented Feb 13, 2020

Render is available on the master branch for testing, 6 template engines are available:

The function uses the correct engine based on the file extension.

func main() {
  app := fiber.New()
  app.Get("/", func(c *fiber.Ctx) {
    data := map[string]interface{}{
      "name": "John",
      "age":  "35",
    }
    var err error
    //err = c.Render("views/test.template", data)
    //err = c.Render("views/test.ace", data)
    //err = c.Render("views/test.amber", data)
    //err = c.Render("views/test.jet", data)
    //err = c.Render("views/test.raymond", data)
    err = c.Render("views/test.mustache", data)
    if err != nil {
      fmt.Println(err)
    }
  })

  app.Listen(3000)
}

@mauricionr
Copy link
Author

json could be added as a template? like in phoenix 🙈 🤔

@Fenny
Copy link
Member

Fenny commented Feb 13, 2020

@mauricionr, feel free to suggest go template engines ( a link would be nice 😄 )

@mauricionr
Copy link
Author

mauricionr commented Feb 13, 2020

https://hexdocs.pm/phoenix/views.html#rendering-json

sorry i forgot to put the link

@Fenny
Copy link
Member

Fenny commented Feb 13, 2020

We only support Go engines for now, maybe we write our own in the far future.

@Fenny Fenny closed this as completed Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants