Build your server with Rust using poem framework.
To build and run this project, you need the following:
- Rust: Install Rust
The project uses a specific version of Rust, which is managed automatically using rustup. Check the rust-toolchain.toml
file for the exact version.
-
Install Rust: If you don't have Rust installed, you can install it with the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone the Repository:
git clone https://github.com/codeitlikemiley/poem-api.git cd poem-api
-
Set the Rust Toolchain:
rustup update
-
Cargo Watch with
cargo-watch
- Install cargo-watch
cargo install cargo-watch
- Run Command:
cargo watch -x run
Note: This auto re-compiles the executable and re-run the server
-
Running the Server:
cargo run
By Default
cargo run
uses.env.example
ENV VariablePORT=3000 HOST=127.0.0.1 APP_SECRET=secret
NOTE: If you need to use other
PORT
you can pass in it as an ENV VariablePORT=8000 cargo run
-
Build Release
cargo build --release
-
Run in Production
APP_ENV=prod PORT=3001 APP_SECRET=SomeRandomString HOST=localhost ./target/release/poem-api
-
Open Swagger UI and Test the API:
open http://localhost:3000/docs
-
Login with username
{
"username": "[email protected]"
}

- Authorization
Copy Paste the token response from
Login
Then Go to any Locked Endpoint with a lock Icon
Click the Lock Icon , it would show a Modal , where you can paste the token
