Can be used Backbone/Marionette with Nunjucks as template engine?

Skip to first unread message

Carlos Catucci

Feb 4, 2020, 5:31:09 AM2/4/20
to backbonejs
Hi folks

I've a question that I coudn't resolve.
I'm developing a microservices API REST system, with rìthe frontend separated from backend. I like to use BB/Marionette 'cause is the more plain and clean of the JS framewors.
But the sndard template engines (most the underscore one) aren't so immediate for me, I'ma Django developer and I've found that Nunjucks of Mozilla foundation is quite similar and perfect for me.
But the examples of use of nunjucks that I found is based on the use it with Express.js of node.
In BB I see that will be passed a template, i.e. as value of ID field of the script type "template" to the key "template" of a ItemView of Marionette.
Can I pass a function like tihis

function( req, res ) {
return res.render( 'index.html' ) ;
to template?

Ther's another problem, the function, in the example where I found it, was part of an app.get() of express, so I don't know in what manner I can pass req/res parameters to the function.

Thank's in advance for any hint


Reply all
Reply to author
0 new messages