Better Programming

Advice for programmers.

Follow publication

Member-only story

How To Deploy a Rust Web Server to Heroku Using Axum, Docker, and GitHub Actions

Fabiano B.
Better Programming
Published in
2 min readMay 20, 2022

Image by author

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:

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Write a response