randoms
randoms
A small and simple web service that returns JSON formatted pseudorandom data - numbers, hexadecimal numbers, UUIDs, and base 64 strings. An excuse to try out Crystal and the companion web framework, Kemal. I had thought it might be useful to have such random data sources for Workflow workflows.
Installation
- Install Crystal
shards install
Build
crystal build --release src/randoms.cr
Usage
./randoms- visit localhost:3000
Endpoints
/hexreturns JSON with data: {random: "b48ed003fbe56939b9b1715542146084"}/hex?length=3returns JSON with data: {random: "b48ed0"}/numberreturns JSON with data: {random: "88"}/number?length=10returns JSON with data: {random: "8"}/uuidreturns JSON with data: {random: "fc07646c-c24b-4744-a31a-87c979a80e26"}/base64returns JSON with data: {random: "KCbA8xgLGyddXMf6X3dzFg=="}
{
"method": "hex",
"data": {
"random": "f87b10c557f16361c9de82afbcfdd257"
},
"responded_at": "2016-12-27T21:20:57+0000"
}
Testing
KEMAL_ENV=test crystal spec
Contributing
- Fork it ( https://github.com/chaserx/randoms/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- chaserx Chase Southard
Repository
randoms
Owner
Statistic
- 1
- 0
- 0
- 0
- 2
- over 3 years ago
- December 26, 2016
License
MIT License
Links
Synced at
Tue, 27 Jan 2026 05:21:35 GMT
Languages