Monday, 3 April 2017

Template parse issue nodejs

I'm quite new to NodeJS , i trying to get a solution for issue facing on my node project

issue is when hitting many users on site showing one user data to another user screen

seems like issue with template parsing , using nsmarty to render template

app.js

var app = express();
var configure = require('./configure');
//default setters
config = configure.app();
$arr = {
  config : config
}

home.js (route file[controller])

$arr['usercorp'] = results[4][0][0];
 $arr['ses_id'] = req.body.sess_id;
 $arr['us_id'] = req.body.id;

template.loadTemplate(req,res,$arr);

template.js

exports.loadTemplate = function(req,res,arr)
{
res.setHeader('Content-Type', 'text/html; charset=UTF-8');
         nsmarty.clearCache(arr.file); 

         stream = nsmarty.assign(arr.file,arr);

    stream.pipe(res);
}

Let me know if need more details

Thanks in advance



via mak

No comments:

Post a Comment