title: Video Chat app on Heroku using Peer js and Node js
body: <p>I'm following this tutorial on <a href="https://www.sitepoint.com/webrtc-video-chat-application-peerjs/" rel="nofollow noreferrer">https://www.sitepoint.com/webrtc-video-chat-application-peerjs/</a> to make a video chat app using peer js, node js and trying to host this on HEROKU I have managed to get the client side working (using express) but don't have any idea how the server side will work</p>
  
  <p>The client side server.js for static files:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  //setting port
  var port = process.env.PORT || 8080
  
  app.use(express.static(__dirname));
  
  //routes
  app.get("/",function(req, res){
  
  res.render("index");
  
  })
  
  app.listen(port,function(){
  
  console.log("app running")
  })  
  </code></pre>
  
  <p>above code is working fine and I can see my index.html via heroku </p>
  
  <p>Other server i.e peer-server.js to get peer information:</p>
  
  <pre><code>var PeerServer = require('peer').PeerServer;
  var server = PeerServer({port: 9000, path: '/peerjs'});
  </code></pre>
  
  <p>I don't have any idea on how to run this code on heroku and get data on script.js</p>
  
  <p>script.js:</p>
  
  <pre><code>$(function(){
  
    var messages = [];
    var peer_id, name, conn;
    var messages_template = Handlebars.compile($('#messages-template').html());
  
    var peer = new Peer({
      host: 'localhost',
      port: 9000,
     path: '/peerjs',
      /* debug: 3,
      config: {'iceServers': [
      { url: 'stun:stun1.l.google.com:19302' },
      { url: 'turn:numb.viagenie.ca',
        credential: 'muazkh', username: 'webrtc@live.com' }
      ]}*/
    });
  
    peer.on('open', function(){
      $('#id').text(peer.id);
    });
  </code></pre>
  
  <p>They (sitepoint) have step by step guidance on how to deploy it on a local server but not on heroku or something similar</p>
  
  <p>Any help will be greatly appreciated</p>