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:

  1. ejs templates
  2. use ejs template node application

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -