title: NodeJS include header and footer without EJS
body: <p>I was hoping someone may be able to assist me with NodeJS. Iv recently started developing my site using NodeJS.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>im looking for a way to send my documents as <em>a header, content, footer</em> style so it reduces repeating code for each section.</p>
  
  <p>I have a <strong>public folder</strong> setup so i can include Js, CSS and common files etc...</p>
  
  <pre><code>self.app.use(express.static(__dirname + '/public'));
  </code></pre>
  
  <p>This all works, however im unsure about how to implement a simple way to join the file content. Every source iv looked at online suggests the "correct" way to do it is via a package called <a href="https://scotch.io/tutorials/use-ejs-to-template-your-node-application" rel="nofollow">EJS</a> templates.</p>
  
  <p>So im looking for something similar to this implementation in EJS:</p>
  
  <pre><code>&lt;header&gt;
      &lt;% include ../partials/header %&gt;
  &lt;/header&gt;
  
  &lt;footer&gt;
      &lt;% include ../partials/footer %&gt;
  &lt;/footer&gt;
  </code></pre>
  
  <p>However, the service im hosting on does not support EJS, so is it possible to do something like this?</p>
  
  <pre><code>self.routes['/'] = function(req, res) {
              res.setHeader('Content-Type', 'text/html');
              res.send(self.cache_get('header.html')+self.cache_get('index.html')+self.cache_get('footer.html') );
          };
  </code></pre>
  
  <p>Is there another simple way to separate header, content and footer to make it simpler to develop website with dynamic content?</p>