Skip to main content
Two orders are ready for pickup and a third is still being packed. This Axum endpoint reads the count from Postgres using SQLx. On floo, the Rust binary runs in a Docker image and the database connection string arrives at runtime. Open the pickup API. To deploy your own copy with a coding agent, paste this from an empty project directory:

Query Postgres from Axum

In an empty directory, create src and save these two files. The handler uses a runtime SQL query, so the image builds without a database. Each running instance shares one pool of up to four connections.
Cargo.toml
src/main.rs

Build the image and run the migration

Dockerfile
floo.app.toml
Choose an available app name starting with axum-pickup- in floo.app.toml. floo runs /axum-pickup-api migrate with the new image before it receives traffic. On later deploys, existing order statuses survive the migration. Dev and prod have separate databases. From the example directory with Rust 1.97, the floo CLI, and a floo sign-in:

Check the first response

Open the dev URL printed by the deploy. The root path returns HTTP 200 with:
A 503 means the handler could not read Postgres. Check the service logs for the SQLx error and confirm that the migration completed. The sample exposes only a count of fixture orders. For a staff-only API, configure App sign-in. If your existing app uses SQLx’s query! macros, generate SQLx offline metadata against your development schema and commit it before building the image. See SQLx offline builds and connecting to managed Postgres.