title: Node.js while video streaming send JSON data
body: <p>I want to stream a local video file and while doing that I want to send some x, y coordinates to the front-end.</p>
  <p>I have a following code which can stream a video but how can I send JSON data alongside? I don't want to create another end-point.</p>
  <pre><code>const express = require(&quot;express&quot;)
  const fs = require(&quot;fs&quot;)
  const app = express()
  
  app.get(&quot;/video&quot;, (req, res) =&gt; {
      const path = &quot;video.mp4&quot;;
      const stat = fs.statSync(path);
      const fileSize = stat.size;
      const head = {
          'Content-Length': fileSize,
          'Content-Type': 'video/mp4'
      }
      res.writeHead(200, head);
      fs.createReadStream(path).pipe(res);
  });
   
  app.listen(3000, function () {
      console.log('App is running on port 3000')
  })
  </code></pre>