RPG dice roller with both Rust CLI and ClojureScript Web interfaces
MIT License
Web and CLI interface to roll dice.
yarn dev
and point browser to localhost:3449
for figwheel and watching the Rust backend. If you don't issue :cljs/quit
at the REPL or you'll have to kill figwheel some other way.yarn prod
and point browser to localhost:8080
for the production build.yarn demo
for a dev server with no hot-reloading - point your browser to localhost:8080
.For EMACS/CIDER, run yarn emacs
and then from Emacs invoke M-x cider-jack-in-clojurescript
. You'll need to invoke (start-figwheel!)
. Further instructions can be found here.
The backend component also has two other CLI modes:
repl
as the first arg for a REPL which will evaluate commands in sequence separated by spaces and prompt for further input until a SIGINT.You can run the webserver directly via roll
(cargo run
) or roll serve
(cargo run -- serve
).
Command formats:
1d2 2d4 3d8
blello
, blello, ian
3 1d7
, 3 1d8 2d9
, 3 blello
, 3 blello ian
The multiplier is a little buggy on the web side - it only rolls out the first trailing arg. Stay tuned.
Web server endpoints:
GET /roll/:cmd
where :cmd
is any of the above, but separated by slashes instead of spaces: /roll/1d6
, /roll/2d8/3d9
, /roll/3/10d20
, /roll/9/blello/ian
GET /items
returns all the items stored in db.sqlite
POST /item
with an application/json
request body like '{"name": "blaster","damage": "1d8"}'
to insert that item into the DB