Skip to content

Instantly share code, notes, and snippets.

@wedesoft
Last active June 23, 2016 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wedesoft/59f436566a960aefbe570deb30f1d017 to your computer and use it in GitHub Desktop.
Save wedesoft/59f436566a960aefbe570deb30f1d017 to your computer and use it in GitHub Desktop.
Guile Artanis user session
(use-modules (artanis artanis) (artanis cookie) (artanis utils))
(init-server)
(get "/" #:session 'spawn
(lambda (rc)
(let [(sid (or (cookie-ref (rc-cookie rc) "sid") (:session rc 'spawn)))
(time (strftime "%c" (localtime (current-time))))]
(tpl->response `(html (body (p ,sid) (p ,time)))))))
(run)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment