play-web-server-xexp.rkt
#lang web-server/insta

(require "web-server-xexp.rkt")

(define (start req)
  (response/html-template
   (html (header (title "advice-pin-oogly-book-r.com"))
         (body (h1 "Today's Advice")
               (p "Don't run with "
                  (% (random-list-element '("scissors"
                                            "toilet plungers"
                                            "cheese graters"
                                            "trays of lasagna"
                                            "cats"
                                            "wolves"
                                            "the bulls")))
                  ".")
               (p "Like us on Facebook for a chance to win $"
                  (% (+ 100 (random 901)))
                  ".")))))

(define (random-list-element lst)
  (list-ref lst (random (length lst))))

;(define (my-preamble-proc) #"")
;(define (my-code-proc) 403)

;(define (start req)
;  (response/html-template
;   #:code     (my-code-proc)
;   #:preamble (my-preamble-proc)
;   (html (body (p "X")))))

;(define (start req)
;  (response/html-template
;   #:code     403
;   #:preamble #"<!DOCTYPE html>\n"
;   (html (body (p "X")))))

;(define my-site-title "Cats & Dogs")
;
;(define (start2 req)
;  (response/html-template
;   (html (head (title (% my-site-title)))
;         (body (h1 (% my-site-title))
;               (p "Kittens claw.")
;               (p "Puppies pee.")))))


;(define (start req)
;  (response/html-template
;   #:code     403
;   #:message  #"Forbidden"
;   #:preamble (my-proc)
;   (html (head (title "Forbidden"))
;         (body (p "Is forbidden dance!")))))
;
;(define (my-headers-proc) '())
;(define (my-cookies-proc) '())


;(response/html-template
; #:message #"Dude"
; #:headers (my-headers-proc)
; #:cookies (my-cookies-proc)
; #:preamble #"<!DOCTYPE html>\n"
; (html (body (p "X"))))
;

; (response/html-template
;  (html (body (p "X"))))

;(response/html-template
; #:preamble #"<!DOCTYPE html>\n"
; (html (body (p "X"))))
;


;; (define (start req) '!!!)