Axum Adapter
The Axum adapter runs Mocktioneer as a native Rust HTTP server. It's the recommended choice for local development and integration testing.
Overview
| Property | Value |
|---|---|
| Crate | mocktioneer-adapter-axum |
| Target | Native (no WASM) |
| Default Port | 8787 |
| Use Case | Development, testing, CI/CD |
Quick Start
cargo run -p mocktioneer-adapter-axumThe server starts at http://127.0.0.1:8787.
Using EdgeZero CLI
edgezero-cli serve --adapter axumThis executes the command defined in edgezero.toml:
[adapters.axum.commands]
serve = "cargo run -p mocktioneer-adapter-axum"Configuration
Build Settings
[adapters.axum.build]
target = "native"
profile = "dev"The Axum adapter uses:
- Native compilation (not WASM)
- Dev profile for faster builds during development
Logging
[adapters.axum.logging]
level = "info"
echo_stdout = trueLogs are written to stdout. Adjust level for more or less verbosity:
trace- Most verbosedebug- Debug informationinfo- Normal operation (default)warn- Warnings onlyerror- Errors only
Docker Deployment
This repository does not include a Dockerfile. If you add one, you can containerize the Axum adapter like this:
# Build the image
docker build -t mocktioneer:latest .
# Run on default port
docker run -p 8787:8787 mocktioneer:latest
# Run on custom port
docker run -p 3000:8787 mocktioneer:latestDevelopment Workflow
Hot Reloading
For automatic rebuilds during development, use cargo-watch:
cargo install cargo-watch
cargo watch -x 'run -p mocktioneer-adapter-axum'Running Tests
# All tests
cargo test
# Core tests only
cargo test -p mocktioneer-core
# Specific test
cargo test handle_openrtb_auctionDebugging
Standard Rust debugging works with the Axum adapter:
# With RUST_BACKTRACE
RUST_BACKTRACE=1 cargo run -p mocktioneer-adapter-axum
# With debug logging
RUST_LOG=debug cargo run -p mocktioneer-adapter-axumPerformance Testing
The Axum adapter is suitable for local performance testing:
# Using wrk
wrk -t4 -c100 -d30s http://127.0.0.1:8787/
# Using hey
hey -n 10000 -c 100 http://127.0.0.1:8787/openrtb2/auction \
-m POST \
-H "Content-Type: application/json" \
-d '{"id":"test","imp":[{"id":"1","banner":{"w":300,"h":250}}]}'Differences from Edge Adapters
The Axum adapter behaves identically to edge adapters for request handling, but:
| Feature | Axum | Edge (Fastly/Cloudflare) |
|---|---|---|
| Startup time | Instant | Cold start possible |
| Debugging | Full access | Limited |
| KV stores | Not available | Platform-specific |
| Logging | stdout | Platform logging |
Customization
To customize the Axum adapter behavior, edit:
crates/mocktioneer-adapter-axum/src/main.rs- Entrypointcrates/mocktioneer-adapter-axum/axum.toml- Adapter-specific config
Example: changing the listen address would require modifying the adapter code.
Next Steps
- Try the Fastly adapter for edge deployment
- Try the Cloudflare adapter for Workers deployment
- Check the API reference for testing endpoints