Version 4 of Wub Direct

Updated 2012-01-27 01:12:52 by CMcC

Direct domains allow you to write a page that processes a GET, takes a bunch of &foo=bar options, and spits out some computed response.

In local.tcl:

namespace eval ::woo {
    proc /woo {r args} {
        return [Http Ok $r [<p> "Woo! [armour $args]"]]
    }

    proc / {r args} {
        return [Http Ok $r [<p> "You said [armour $args]"]]
    }
}

in site.config:

# define the /woo URL prefix
/woo {
    domain Direct        ;# prefix handled as a Direct domain
    namespace ::woo        ;# Direct should look in ::woo namespace for functions
}

results:

http://localhost:8080/woo/?moop=1
==> You said moop 1

http://localhost:8080/woo/woo?moop=1
==> Woo! moop 1

http://localhost:8080/woo/woo?foo=bar&woo=woo
==> Woo! foo bar woo woo