Thursday 8 June 2017

Pass variables to template

im using NodeJS/Expressjs and I have this route:

router.post({

   var value = req.body.value;
   //I NEED TO DO SOMETHING LIKE
   var file = '../test/test.js';
   file.render(value);

});

and /test/test.js looks like

var myVar = {value1};
var someStruct = {key: {value2}}
function Test(){
  var info = {value3};
}

Which is the good way to do this? Can I use some templating system?

Regards,



via mdv

No comments:

Post a Comment