Full-Stack Web Development with Vue.js and Node

(singke) #1
Going Live Chapter 10

The last thing we need to change is the port of the application. The Heroku application
automatically assigns a port when deploying an application. We should only be using


port 8081 of the development environment only. So, let's verify that our server.js has


the following code:


const port = process.env.PORT || 8081;
app.use('/', router);
var server = app.listen(port, function() {
console.log(`api running on port ${port}`);
});

module.exports = server

Now, let's commit and push the changes to the master and then deploy again:


$ git add package.json config/Config.js server.js
$ git commit 'Update MongoDB url and app port'
$ git push origin master
$ git push heroku master

The application should be successfully deployed to Heroku and we should be able to view


our application at https:/​/​movie-​rating-​app-​1.​herokuapp.​com/​:

Free download pdf