Rendering HTML Views
Closed this issue · 4 comments
s2t2 commented
Hi, I was wondering if it is possible to use this library to render an HTML view file at a given path. And if so, how?
s2t2 commented
I guess the desired usage would be something like:
app.Get("/hello", func(req *request.Request, res *response.Response, next func()){
res.Render("./views/hello.html", false)
})
AlexNodex commented
This isn’t really a twig bug.
Rendering the html to a file is trivial because the render method returns a string
Please use places like stack overflow for usage issues and GitHub for bugs and genuine issues
…Sent from my iPhone
On 14 Feb 2018, at 21:20, MJ Rossetti ***@***.***> wrote:
I guess the desired usage would be something like:
app.Get("/hello", func(req *request.Request, res *response.Response, next func()){
res.Render("./views/hello.html", false)
})
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
AlexNodex commented
Apologies for my last comment, I was in the wrong repo!
…Sent from my iPhone
On 14 Feb 2018, at 21:20, MJ Rossetti ***@***.***> wrote:
I guess the desired usage would be something like:
app.Get("/hello", func(req *request.Request, res *response.Response, next func()){
res.Render("./views/hello.html", false)
})
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
DronRathore commented
Hey @s2t2, apologies for delayed response, I think i didn't quite get you, do you want to pass dynamic options to the html or you just want to send the HTML response?
You can use res.Send
to send an HTML file by passing a file path.
But would be a good feature though to support this, I may work on this one on a weekend, I am thinking of letting render function take options too so that you can render dynamic content.