This app supports the Sinatra "Hangperson" CHIPS assignment in the Engineering Software as a Service (ESaaS) course. It is a replacement for the old Watchout4snakes service.
The app returns a random 5 to 8 letter English word suitable for use in playing the game "Hangman".
The app is online at http://randomword.saasbook.info
.
Note: The current deployment works only over plain HTTP, not HTTPS.
This code is licensed under CC-BY-4.0.
Future enhancements could include respecting a Locale argument.
The following routes are recognized:
get '/RandomWord'
or post '/RandomWord'
with optional URL
parameter format
is interpreted as follows:
-
format=text
,format=txt
, or omitted: returns a bare random word with content-typetext/plain
(equivalent toPOST http://watchout4snakes.com/wo4snakes/Random/RandomWord
) -
format=json
: returns a JSON object{"success": "true", "word": "
word"}
with content-typeapplication/json
-
format=html
: returns a minimal legal HTML5 page whosebody
consists of a singlep
element containing the word -
Any other value for
format
results in a 501 error (resource not available).
get '/'
or post '/'
is the same as get '/RandomWord?format=html