title: Ejs include with routed url
body: <p>The files <code>header.ejs</code>,<code>menu.ejs</code>,<code>footer.ejs</code> are in <code>views/layouts/basic/</code>.</p>
  
  <p>I want to include these files in the <code>views/index.ejs</code>.</p>
  
  <p>So, I tried:</p>
  
  <pre><code>&lt;% include ./layouts/basic/header.ejs %&gt;
  </code></pre>
  
  <p>It works well. But A lot of view files were created, and the relative paths were all different.</p>
  
  <p>So, in <code>app.js</code>:</p>
  
  <pre><code>app.use('/layout', express.static(__dirname + '/views/basic/layouts'));
  </code></pre>
  
  <p>and <code>index.ejs</code>:</p>
  
  <pre><code>&lt;% include /layout/header.ejs %&gt;
  </code></pre>
  
  <p>but it doesn't work. It occurs</p>
  
  <pre><code> ENOENT: no such file or directory, open '/layout/header.ejs'
  </code></pre>
  
  <p>However, <code>header.ejs</code> is downloaded when you access the browser with '<a href="http://localhost:3000/layout/header.ejs" rel="nofollow noreferrer">http://localhost:3000/layout/header.ejs</a>'.</p>
  
  <p>Why doesn't it work? and how can I fix it?</p>