Giter Club home page Giter Club logo

d20_api's Introduction

d20 API

REST API for simulating RPG dice rolls, written in Ruby with Sinatra.

Routes

The following routes will simulate one rolled die:

GET /d4

GET /d6

GET /d8

GET /d10

GET /d12

GET /d20

GET /d100

Each route will also accept a number of dice to roll. The following request will roll three d8 dice:

GET /d8/3

d4, d6, d8, d10, and d12 will include the total for all dice rolled. d20 and d100 will include the high and low values if you roll multiple dice.

How to use

Open a terminal window and start the Ruby API.

ruby app.rb

Use a REST client (like Postman) to make GET requests, as shown below.

Roll a d4

GET http://localhost:4567/d4
{
  "roll": [3],
  "total": 3
}

Roll ten d4

GET http://localhost:4567/d4/10
{
  "roll": [1,1,2,4,1,4,2,2,4,1],
  "total": 22
}

Roll a d20

GET http://localhost:4567/d20
{
  "roll": [14]
}

Roll two d20

GET http://localhost:4567/d20/2
{
  "roll": [15,13],
  "high": 15,
  "low": 13
}

d20_api's People

Stargazers

Will Ricketts avatar

Watchers

James Cloos avatar Matt Hughes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.