title: Using Socket.IO in NodeJS works local, but not on Heroku
body: <p>Im traying to create a NodeJs Server for android clients. When i run the server local it works perfect! But when i try to host the server in Heroku, it does not work. I get a Application Error "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command".
  when i take the line &lt;> out from index.js, it works also on Heroku.  </p>
  
  <p>In the logs i get a H10 error: 
  2019-07-05T04:09:20.917720+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" ....</p>
  
  <p>2019-07-05T04:09:21.119408+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" ....</p>
  
  <p>What is the problem ? Many thanks!</p>
  
  <p><strong>Index.js</strong></p>
  
  <pre><code>const express = require('express');
  app = express(),
      http = require('http'),
      server = http.createServer(app);
  
      // without this line it works also on Heroku
      io = require('socket.io').listen(server); 
  
  const path = require('path')
  const PORT = process.env.PORT || 5000
  
  express()
      .use(express.static(path.join(__dirname, 'public')))
      .set('views', path.join(__dirname, 'views'))
      .set('view engine', 'ejs')
      .get('/', (req, res) =&gt; res.render('pages/index'))
      .listen(PORT, () =&gt; console.log(`Listening on ${ PORT }`))
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "node-js-getting-started",
    "version": "0.3.0",
    "description": "A sample Node.js app using Express 4",
    "engines": {
      "node": "10.x"
    },
    "main": "index.js",
    "scripts": {
      "start": "node index.js",
      "test": "node test.js"
    },
    "dependencies": {
      "ejs": "^2.5.6",
      "express": "^4.15.2"
    },
    "devDependencies": {
      "request": "^2.81.0",
      "tape": "^4.7.0"
    },
    "repository": {
      "type": "git",
      "url": "https://github.com/heroku/node-js-getting-started"
    },
    "keywords": [
      "node",
      "heroku",
      "express"
    ],
    "license": "MIT"
  }
  </code></pre>
  
  <p><strong>app.json</strong></p>
  
  <pre><code>{
    "name": "Start on Heroku: Node.js",
    "description": "A barebones Node.js app using Express 4",
    "repository": "https://github.com/heroku/node-js-getting-started",
    "logo": "https://cdn.rawgit.com/heroku/node-js-getting-started/master/public/node.svg",
    "keywords": ["node", "express", "heroku"],
    "image": "heroku/nodejs"
  }
  </code></pre>
  
  <p><strong>gitignore</strong></p>
  
  <pre><code># Node build artifacts
  node_modules
  npm-debug.log
  
  # Local development
  *.env
  *.dev
  .DS_Store
  
  # Docker
  Dockerfile
  docker-compose.yml
  </code></pre>