import jester, asyncdispatch, htmlgen, strutils, math, typetraits
routes:
get "/":
var html = ""
html.add("<form method=\"post\">")
html.add("min:<br>")
html.add("<input type=\"text\" name=\"min\" value=\"\"><br>")
html.add("max:<br>")
html.add("<input type=\"text\" name=\"max\" value=\"\"><br><br>")
html.add("<input type=\"submit\" value=\"Submit\">")
html.add("</form>")
resp html
post "/":
let min = parseInt(request.params.getOrDefault("min"))
let max = parseInt(request.params.getOrDefault("max"))
let answer = random(max) + min
resp intToStr(answer)
runForever()