Get resulting view as string, instead of rendering

478 views
Skip to first unread message

Alex Brown

unread,
Apr 18, 2012, 9:54:59 PM4/18/12
to expre...@googlegroups.com
I'm trying to use my view templates to generate HTML for sending emails.

Is there a way to do this with express?
Should i be using the template engine directly?

kind of like:

var html = render('myView', model:myModel);

Sugarstack

unread,
Apr 20, 2012, 4:13:47 AM4/20/12
to expre...@googlegroups.com
You can pass a callback to res.render. That will stop it sending anything, and you can access the rendered HTML (or err) to do w/e with.

tjholowaychuk

unread,
Apr 20, 2012, 5:06:06 PM4/20/12
to expre...@googlegroups.com
there's app.render() and res.render(), res.render() has an optional callback of (err, html), and app.render always requires a callback
Reply all
Reply to author
Forward
0 new messages