How to build restful web apis in spring boot and deploy it to heroku? Part-3

Our work isn’t done yet if it isn’t deployed.  There are quite a lot of options when it comes to live platforms to use all of which have their merits and demerits, for this article we’ll use heroku, which is an extremely trusted platform for production grade hosting and takes away all the stress that usually comes with creating and maintaining high quality server environment, best of all it has a free tier that you can use, so head on to heroku  and create an account if you don’t have any.

I’m assuming here that you’re familiar with git, if you aren’t checkout this tutorial here, so fire up your terminal( I’m on Linux, on windows it should be command-line) run heroku login, input your email and password then run heroku apps:create <app_name> (in app name is whatever you decided to call it), in a few seconds you should see a success message, still in your terminal, git commit your project, run heroku git:remote -a <app_name>.

Since we are working with a database, we’ll have to provision our database on heroku, run heroku addons:create heroku-postgresql, head back to your application.properties file and modify it to look like this:

Then simply run git add . , git commit -m “done” then git push heroku master.  That’s it!, your api should be up and running.

Have any questions, do ask in the comments below.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *