doc.txt

Web-page

_Web-page_
_web-page_

This collection provides one file:

 _web-page.ss_: convenient syntax for web applications

======================================================================

web-page.ss
-----------

> (web-page defn ... expr ...) : SYNTAX

The `web-page' form works similarly to _send/suspend/dispatch_, except
that, as a convenience, the result may be an x-expression with
embedded procedures. These embedded procedures are automatically
converted to URL's via _callback-url_.

The `web-page' form may contain internal definitions. The bindings
produced by internal definitions are in scope in the body of the
`web-page' expression.

> (callback-url proc) : (request -> response) -> string

Only for use within the dynamic context of evaluation of a `web-page'
form, this procedure converts a web application callback into an
embeddable URL.

> invalid-xexpr-handler : (parameterof (exn:invalid-xexpr any -> response))

A parameter that allows customization of the "invalid X-expression"
error page produced by the web server. By default, this module
provides an error handler that's more useful than the default
web-server error handler, but you can customize it as well.

EXAMPLES -------------------------------------------------------------

(web-page
  (define restart (callback-url (lambda (request)
                                  (main 'initial-value))))
  `(html (body (a ([href ,restart]) "Restart"))))

(web-page
  `(html (body (a ([href ,(lambda (request)
                            (main 'initial-value))])
                  "Restart"))))