Skip to content
Matthias Görges edited this page Aug 12, 2020 · 1 revision

Applies all content substitutions to serve a dynamic website document.

Parameter Description
data website content string on which substitutions will be performed

Example

(website-addhook #f "/index.html"
  (lambda (args)
    (let ((data (cadr (assoc "DATA" args))))
      (website-substitute data))))

(website-addhook #f "/index.html" "<h1>[TEXT]</h1>[PROC]")

(website-addsubstitution "[TEXT]" "replaced text")
(website-addsubstitution "[PROC]" (let ((a 0)) (lambda () (set! a (+ a 1)) (number->string a))))

(website-serve #f 8080)
Clone this wiki locally