Documentation Source Text

Artifact Content
Login

Artifact 44921590dcfeaea785ee8932a1cec9e422077faf7d93c971eb8b4269bfe7b3d1:


eval [db one {SELECT sqlar_uncompress(data,sz) FROM sqlar
               WHERE name='wapp.tcl'}]
proc wapp-default {} {
  global wapp
  set x [string trimleft [dict get $wapp PATH_INFO] /]
  if {$x==""} {set x index.html}
  set doc [db one {SELECT sqlar_uncompress(data,sz)
                   FROM sqlar WHERE name=('doc/' || $x)}]
  if {$doc==""} {
    wapp-subst {<h1>Not Found: %html(/$x)</h1>}
    return
  }
  dict set wapp .reply $doc
  switch -glob -- $x {
    *.html {wapp-mimetype text/html}
    *.gif {wapp-mimetype image/gif}
    *.jpg {wapp-mimetype image/jpeg}
    *.png {wapp-mimetype image/png}
    *.css {wapp-mimetype text/css}
    default {wapp-mimetype text/html}
  }
}
wapp-start $argv