<html>
  <head></head>
  <body>
    Hello
    <div id="output"></div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script src="watson-speech.js"></script>
    <script>
    class Speech {
      startListening() {
        fetch('http://localhost:3000/watson-token').then(function(response) {
          return response.text();
        }).then((token) => {
          var stream = WatsonSpeech.SpeechToText.recognizeMicrophone({
              token: token,
              keepMic: true
          });

          stream.setEncoding('utf8'); // get text instead of Buffers for on data events

          stream.on('data', function(data) {
            console.log(data);
          });

          stream.on('error', function(err) {
              console.log(err);
          });
        })
      }
    }

    $(document).ready(function() {
      const speech = new Speech();
      speech.startListening();
    });
    </script>
  </body>
</html>

Add a page for calling Watson.
Add a page for calling Watson.
