Is there a library for node.js to "parse" a content of a file with specific syntax? In example, I have a file which I want to serve on my node.js server:
<!DOCTYPE html>
<html>
<head>...</head>
<body>
    <?node echo Date.getTime(); ?> <!-- or something like this, I hope you have got the idea -->
</body>
</html>
Then it returns a HTML document:
<!DOCTYPE html>
<html>
<head>...</head>
<body>
    08.08.2013 <!-- or something like this, I hope you have got the idea -->
</body>
</html>
I don't know how to describe it more precisly, something like PHP for Apache server, but for node.js server.
Just use CGI-Node. It allows you to run Node.js on any web hosting just like PHP:
<html>
    <head>
    </head>
    <body>
        <? var helloWorld = 'Hello World!'; ?>
        <?= helloWorld ?>
    <br>
    <b>I can count to 10: </b>
    <? for (var index = 0; index <= 10; index++) { ?>
        <?= index ?>
    <? } ?>
    </body>
</html>
                        EJS templates look and feel like PHP and ASP but are pure JS: https://ejs.co/
Their example:
<ul>
<% for(var i=0; i<supplies.length; i++) {%>
   <li><%= supplies[i] %></li>
<% } %>
</ul>
                        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