title: How can I find the file inside the directory in Node.js?
body: <p>I am trying server-side js injection for my assignment.
  I am able to find the directory names using the command:</p>
  
  <pre><code>res.end(require('fs').readdirSync('.').toString())
  </code></pre>
  
  <p>output:</p>
  
  <p><code>photos,practice.db,public,routes,fun,server.js,views</code></p>
  
  <p>Now I want to look inside the 'fun' directory and read it's file content.
  I tried:</p>
  
  <pre><code>res.end(require(‘fs’).readFileSync(‘fun’))
  </code></pre>
  
  <p>but it's not working because it's a directory. </p>