Wub Direct

I can't get this to work at all, nor can I get the examples in the current wubwikit to work. I'm guessing local.tcl is a file local to wiki being implemented, but it is no longer present and I'd like to know when and where it is sourced. I have also tried Nub, but this does not seem to work either, I uncomment things but when I start the server either the domain is unknown or it errors out, usually looking for something like defs(Hello). Do we have anything more up-to-date, or a working example of exactly how to install a domain? Larry Smith

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

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

http://localhost:8080/woo/woo?fnurgle
==> Woo! fnurgle {}

ATK - 2015-08-29 07:07:09

You can add a nub redirect in site.config from your domain root to /woo url prefix

# add domain root redirect to /woo

/ {

  redirect /woo/

}

When this is redirected to /woo URL prefix, your /woo config in site.config will come to play.

Furthermore, local.tcl is sourced in ${WubHome}/Wub/Site.tcl