I can't seem to figure out how to include a file using Node.js. All of the other questions seem to discuss including other JS files, but I'm looking for the equivalent of a PHP include (files that can contain HTML content).
Usually in PHP, my view files like this:
...stuff
<?php include 'header.php'; ?>
<?php include 'nav.php'; ?>
... more stuff
<?php include 'footer.php'; ?>
And for example in nav.php
I have:
<nav role=navigation>
<ul>
<!-- links -->
</ul>
</nav>
Is there similar functionality in Node or do I have to change my way of developing web applications? I am using the Express framework if that helps.
A short, working example would be highly appreciated.
No, that isn't the way nodeJS is working. If you like to compare, compare nodejs to ruby or ASP.NET. There is jade, as dystroy said, but if you are familiar with HTML syntax prefer ectjs for example :
stuff...
<div id="content">stuff</div>
<% include 'footer.ect' %>
Of course, if there is code to include use require