klement97 / angular-heroku

An angular app to show the required settings to deploy on Heroku.
5 stars 46 forks source link

angular12 #19

Closed tanjunior closed 1 year ago

tanjunior commented 3 years ago

Hello,

I read your article on How to Deploy Your Angular App to Heroku in Minutes and found it to be very informative.

Sadly as I was following the steps I found out that it is quite outdated.

ng build --prod does not work anymore the new command is ng build --configuration production

and the angular.json file from the latest starter templates was changed as well

      "builder": "@angular-devkit/build-angular:browser",
      "options": {
                "outputPath": "www",
                "index": "src/index.html",
                "main": "src/main.ts"

Thus, the code for express

      app.use(express.static('./dist/angular-heroku'));

      app.get('/*', (req, res) =>
          res.sendFile('index.html', {root: 'dist/angular-heroku/'}),
      );

does not work as well.

I tried changing it to

      app.use(express.static('./www'));

      app.get('/*', (req, res) =>
          res.sendFile('index.html', {root: 'www/'}),
      );

and ran the node server.js with no errors but it seems like it's not listening