An API written in Rust to roll RPG dice
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.toml
Dockerfile
LICENSE
README.md
Rocket.toml

README.md

Roll API

Roll RPG dice. Used inside of Astral Virtual TableTop.

Routes

GET /v1/:command

Roll a single type of die. Use TTML syntax to write roll functionality.

Examples:

# Roll a single d20
curl -H 'Content-Type: application/json' 'http://localhost:1337/v1/1d20'

# Reroll anything below a 2
curl -H 'Content-Type: application/json' 'http://localhost:1337/v1/4d8rr<2'

# Set min/min of a die
curl -H 'Content-Type: application/json' 'http://localhost:1337/v1/1d100min2max99'

# Custom sides
curl -H 'Content-Type: application/json' 'http://localhost:1337/v1/1d[0,2,4,6,8,10]'

# Add a comment
curl -H 'Content-Type: application/json' 'http://localhost:1337/v1/1d20[Rolling for gold!]'

Roll Your Own

Looking to run the API locally?

The API can be built using Rust (nightly) or Docker.

Access the API at http://localhost:1337/.

Rust

# Build
cargo +nightly build --release

# Run
cargo run

Docker

# Build
docker build -t astral/roll_api:latest .

# Run
docker run -d -p 1337:1337 astral/roll_api:latest

License

MIT © 2017-2018 Unicorn Heart Club LLC