title: Check if file exists on my sever - node js
body: <p>When I'm using a url query like "<a href="http://localhost:8080/?file=index.js" rel="nofollow noreferrer">http://localhost:8080/?file=index.js</a>", I get always "the file doesn't exist".</p>
  
  <p>The file do exist.
  Any suggestions?</p>
  
  <p>Purpose: Find if the file exists on my server. the file's name must be in the file parameter.</p>
  
  <pre><code>let http = require("http");
  let fs = require("fs");
  
  http.createServer(function(req,res) {
      let url2 = req.url;
      if(fs.existsSync(url2.file)==true)
      {
          res.end("The file exists");
      }
  
      else{
          res.end("The file doesn't exists");
      }
  
  }).listen(8080);
  
  </code></pre>
  
  <p>Thanks !</p>