im new to node and i've searching ways to add dynamic data into html files, like php:
<?php echo $data; ?>
i've found that jade seems to be the exact way for node, but seems to be a little confusing, isn't there a way bit more like php?, something like:
{{data}} where data is var data or function,
-data- where data is var data or function,
etc.
PD: im new to node and javascript, but i have experience on php, so any tutorial or book to do so will be appreciated
i recommend using Swig js and it does exactly what you are asking for, just pass the variables from the node server, in express js i use it like this:
res.render('index.html', {'name': 'mecha'});
then in my index.html i would just use:
<p>{{ name }}</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With