node.js - Send a parameter along with sendfile -
i using nodejs
i have code
var someparameter ="teststst"; var filelocation = path.resolve(__dirname + '/../public/resetpassword.html'); console.log(filelocation); res.sendfile(filelocation);
i want send someparameter in resetpassword.html can tell me how ?
thanks
you can't. (not without engine)
passing parameters html won't have effect (and isnt possible) can use template engine such jade (or ejs if want stay html)
defined as:
app.engine('.html', require('ejs').__express); app.set('views', __dirname + '/views'); app.set('view engine', 'html');
and can 'render' view parameters:
app.get('/', function(req, res){ res.render('index', { users: users, title: "ejs example", header: "some users" }); });
usaful info:
Comments
Post a Comment