This is the minimal reproducible code example for my current picolisp webpage.

(load'@lib/http.l'@lib/xhtml.l)
(de ana()
  (out "+log.txt" (prinl *Url " " (pack *Agent) " "*Adr " " (time (time)))) )
(de main()  (html 0 "Analytics" "@lib.css"() (ana) ) )
(de go()
  (server 8080 "!main") )

$ pil analytics.l -go

It logs url, agent, & ip address when someone visits this page.

My question is how to have picolisp run the ana function whenever a request for 
a file or another html page arrives when it's running as a generic server.

#load file containing ana function$ pil @lib/http.l --server 8080 ana.l
$ curl localhost:8080/tst.html
#log ip, agent, url in log.txt$ localhost:8080/n.txt 
#log ip, agent, url in log.txt


JmageK
-- 
Securely sent with Tutanota

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to