DEV Community

Cover image for Deploying Golang API to Heroku
Navin Kodag
Navin Kodag

Posted on

Deploying Golang API to Heroku

Deploying a Go API on Heroku

To deploy it on Heroku.

I'll assume you have Heroku cli installed and logged in.
or you can start here.
Install heroku cli

  • Create a Procfile that points to our binary with one line and place it in the root of the directory
// Profile
web: bin/Intersect_api
Enter fullscreen mode Exit fullscreen mode
  • Run the app locally to test using
heroku local
Enter fullscreen mode Exit fullscreen mode
  • Create a heroku app
heroku create intersect-api-v2
Enter fullscreen mode Exit fullscreen mode
  • Then commit our changes on git
git add .
git commit -m '💪'
Enter fullscreen mode Exit fullscreen mode
  • And at the end, simply deploy our app using
git push heroku heroku-deploy:master
Enter fullscreen mode Exit fullscreen mode
  • (Optional) Subsequent change can be commit using
git push heroku master
Enter fullscreen mode Exit fullscreen mode

Extra

  • You can read the logs from with
heroku logs
Enter fullscreen mode Exit fullscreen mode

That's about it.
Now we can check our server at,

https://intersect-api-v2.herokuapp.com

Top comments (0)