title: at=error code=H10 desc="App crashed" method=GET path="/"
body: <p>I have been trying to make MEAN application with Heroku but I got this err. I don't know what is problem... I need some help. I looked for many solutions. But I had the same errors.
  And I also attach my git. <a href="https://github.com/handsomehyunsu/resume/tree/heroku" rel="nofollow noreferrer">https://github.com/handsomehyunsu/resume/tree/heroku</a>
  Thank you.</p>
  <pre><code>2020-11-08T08:59:22.685557+00:00 heroku[router]: at=error code=H10 desc=&quot;App crashed&quot; method=GET path=&quot;/&quot; host=hyunsukimresume.herokuapp.com request_id=51fc6ab7-2c9d-431c-b8a2-2a7a82ce79c3 fwd=&quot;14.50.155.250&quot; dyno= connect= service= status=503 bytes= protocol=https
  2020-11-08T08:59:23.143224+00:00 heroku[router]: at=error code=H10 desc=&quot;App crashed&quot; method=GET path=&quot;/favicon.ico&quot; host=hyunsukimresume.herokuapp.com request_id=b9cb9676-fd30-4987-9a48-3bf71fa095a3 fwd=&quot;14.50.155.250&quot; dyno= connect= service= status=503 bytes= protocol=https
  </code></pre>
  <p>Procfile</p>
  <pre><code>web: node server.js
  </code></pre>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;my-resume&quot;,
    &quot;version&quot;: &quot;0.0.0&quot;,
    &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;start&quot;: &quot;node server.js&quot;,
      &quot;build&quot;: &quot;ng build&quot;,
      &quot;test&quot;: &quot;ng test&quot;,
      &quot;lint&quot;: &quot;ng lint&quot;,
      &quot;e2e&quot;: &quot;ng e2e&quot;,
      &quot;dev&quot;: &quot;nodemon server.js&quot;,
      &quot;postinstall&quot;: &quot;ng build --output-path dist&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;^10.1.6&quot;,
      &quot;@angular/cdk&quot;: &quot;^10.2.7&quot;,
      &quot;@angular/common&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/compiler&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/core&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/forms&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/material&quot;: &quot;^10.2.7&quot;,
      &quot;@angular/platform-browser&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;~10.1.5&quot;,
      &quot;@angular/router&quot;: &quot;~10.1.5&quot;,
      &quot;bcryptjs&quot;: &quot;^2.4.3&quot;,
      &quot;body-parser&quot;: &quot;^1.19.0&quot;,
      &quot;bootstrap&quot;: &quot;^4.5.3&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
      &quot;mongoose&quot;: &quot;^5.10.11&quot;,
      &quot;mongoose-unique-validator&quot;: &quot;^2.0.3&quot;,
      &quot;rxjs&quot;: &quot;~6.6.0&quot;,
      &quot;tslib&quot;: &quot;^2.0.0&quot;,
      &quot;zone.js&quot;: &quot;~0.10.2&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@angular-devkit/build-angular&quot;: &quot;~0.1001.6&quot;,
      &quot;@angular/cli&quot;: &quot;~10.1.6&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;~10.1.5&quot;,
      &quot;@types/jasmine&quot;: &quot;~3.5.0&quot;,
      &quot;@types/jasminewd2&quot;: &quot;~2.0.3&quot;,
      &quot;@types/node&quot;: &quot;^12.11.1&quot;,
      &quot;codelyzer&quot;: &quot;^6.0.0&quot;,
      &quot;jasmine-core&quot;: &quot;~3.6.0&quot;,
      &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
      &quot;karma&quot;: &quot;~5.0.0&quot;,
      &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;,
      &quot;karma-coverage-istanbul-reporter&quot;: &quot;~3.0.2&quot;,
      &quot;karma-jasmine&quot;: &quot;~4.0.0&quot;,
      &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;,
      &quot;nodemon&quot;: &quot;^2.0.6&quot;,
      &quot;protractor&quot;: &quot;~7.0.0&quot;,
      &quot;ts-node&quot;: &quot;~8.3.0&quot;,
      &quot;tslint&quot;: &quot;~6.1.0&quot;,
      &quot;typescript&quot;: &quot;~4.0.2&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;~10.16.3&quot;,
      &quot;npm&quot;: &quot;~6.14.8&quot;
    }
  }
  </code></pre>
  <p>server.js</p>
  <pre><code>const { debug } = require('console');
  const http = require('http');
  const app = require('./backend/app');
  
  const normalizePort = val =&gt; {
      var port = parseInt(val, 10);
  
      if(isNaN(port)){
          //named pipe
          return val;
      }
  
      if(port &gt;= 0){
          //port number
          return port;
      }
      
      return false;
  };
  
  const onError = error =&gt; {
      if(error.svscall !== &quot;listen&quot;){
          throw error;
      }
      const bind = typeof addr === &quot;string&quot; ? &quot;pipe &quot; + addr : &quot;port &quot; + port;
      switch(error.code){
          case &quot;EACCES&quot;:
              console.log(bind + &quot; requires elevated privileges&quot;);
              process.exit(1);
              break;
          case &quot;EADDRINUSE&quot;:
              console.log(bind + &quot; is already in use&quot;);
              process.exit(1);
              break;
          default:
              throw error;
      }
  };
  
  const onListening = () =&gt; {
      const addr = server.address();
      const bind = typeof addr === &quot;string&quot; ? &quot;pipe &quot; + addr : &quot;port &quot; + port;
      debug(&quot;Listening on &quot; + bind);
  };
  
  const port = normalizePort(process.env.PORT || &quot;3000&quot;);
  app.set(&quot;port&quot;, port);
  
  const server = http.createServer(app);
  server.on(&quot;error&quot;, onError);
  server.on(&quot;listening&quot;, onListening);
  server.listen(port);
  </code></pre>
  <p>backend/app.js</p>
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const mongoose = require(&quot;mongoose&quot;);
  
  const postsRoutes = require('./routes/posts');
  const userRoutes = require('./routes/user');
  
  const app = express();
  
  //mongodb connect
  mongoose.connect(&quot;mongodb+srv://test_username:&quot; + process.env.MONGO_ATLAS_PW + &quot;@cluster0.utmlm.mongodb.net/myResume?retryWrites=true&amp;w=majority&quot;)
      .then(() =&gt; {
          console.log('connected to database!!');
      })
      .catch(() =&gt; {
          console.log('connection failed');
      })
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  
  //CORS 
  app.use((req, res, next) =&gt; {
      res.setHeader(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
      res.setHeader(
        &quot;Access-Control-Allow-Headers&quot;,
        &quot;Origin, X-Requested-With, Content-Type, Accept, Authorization&quot;
      );
      res.setHeader(
        &quot;Access-Control-Allow-Methods&quot;,
        &quot;GET, POST, PATCH, PUT, DELETE, OPTIONS&quot;
      );
      next();
    });
  
  
  app.use(&quot;/posts&quot;, postsRoutes);
  app.use(&quot;/user&quot;, userRoutes);
  
  
  module.exports = app;
  </code></pre>