Member-only story
How To Deploy a Rust Web Server to Heroku Using Axum, Docker, and GitHub Actions
Tips to write production-ready code

Hello. Today, we’re gonna use Axum as our web framework.
So, to start things off, we need to add Axum and Tokio as dependencies to Cargo.toml
.
On the main.rs
, we’re gonna add the hello world version from Axum’s official documentation:
This is a good start, but we need to make the port the server listens to more flexible to work on Heroku. We need to use the environment variable PORT
, as shown below: