title: How to execute HTML-Events with NodeJS?
body: <p>I need the Nodejs-fileserver for saving some text but I want to do this with a website written in html.
  How can I do something like this?
  Here is an example but there only comes the failure: 'book() isn't defined'.</p>
  <pre><code>const http = require('http');
  const fs = require('fs');
  
  http.createServer( function (req, res) {
    res.writeHead(200,{'Content-Type': 'text/html'})
    res.write('&lt;meta charset=&quot;utf-8&quot;&gt;');
    res.write('&lt;button onclick=&quot;book(this)&quot;&gt;Buchen&lt;/button&gt;');
    res.end();
  }).listen(8080);
  
  function book(sender)
  fs.appendFile('test.csv',sender, function (err) {
      if (err) {throw err};
      console.log(&quot;Schreiben erfolgreich&quot;);
    });
  }
  </code></pre>
  <p>When I connect the nodejs file with the script tag, can I handle the code of the html file?</p>
  <pre><code>&lt;script src=&quot;server.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>How can I execute the nodejs book() function with the html button?</p>