title: How do I parse data with url.parse(...)?
body: <p>I found this sample code of a nodeJS server. I don't understand what this line of code does, what is the true for:</p>
  
  <pre><code>var urlParts = url.parse(req.url, true) 
  </code></pre>
  
  <p>The following line is also unclear to me. Why is it neccessairy to write data.txt?</p>
  
  <pre><code>fs.writeFileSync("data.txt", data);
  </code></pre>
  
  <p>SERVER</p>
  
  <pre><code>server = http.createServer(function(req, res) {
  
    res.writeHead(200, {
      'Content-Type': 'text/plain',
      'Access-Control-Allow-Origin': 'http://localhost'
    });
  
    var urlParts = url.parse(req.url, true),
        data = urlParts.query.data;
  
    fs.writeFileSync("data.txt", data);
  
    res.end("OK");
  });
  </code></pre>